-
Notifications
You must be signed in to change notification settings - Fork 8
HowToDisableModel
The following instructions apply to List Controllers.
Normally the function bar of a List Controller shows the following buttons:

if you set IsReadOnly: True at model level the standard "insert", "Edit" and "Delete" buttons will disappear in all List Controller using that model.
In case you have different Views using the same Model and you want to allow different operations, than set the node Controller/GridPanelController in the view:
For example. You can allow just Viewing and Inserting records with the following code:
Type: Data
Controller: List
GridPanelController:
AllowViewing: True
PreventDeleting: True
PreventAdding: True
PreventEditing: Falseyou will obtain the following situation:

In case you need to prevent editing or deleting for a specific record in accordance with some fields' values you have to:
- write Delphi code in
Rule.pas. Inherit theEditRecordprocedure, check data values and, in case raise an exception as in the following simple example extracted from a real-world project:
type
TinterventionEdit= class(TKRuleImpl)
public
procedure EditRecord(const ARecord: TKRecord); override;
end;
....
implementation
procedure TinterventionEdit.EditRecord(const ARecord: TKRecord);
begin
inherited;
if ARecord.FieldByName('STATUS').AsString = 'APPR' then
RaiseError(You can't modify an already approved intervention');
end;- Implement the
Rulesnode in the model:
Rules:
interventionEdit:In case of master/detail form you can enable/disable inserting, editing, deleting even for detail records. You have to specify AllowViewing, PreventDeleting, PreventAdding, PreventEditing subnodes for the detail in DetailTables/Table/Controller node of the view.
- Kitto at a glance
- Getting started
- Setup
-
Basic concepts
- Basic Materials
- Controllers
- Panel-Based
- [List] (List)
- [Form] (Form)
- [GridPanel] (GridPanel)
- [ChartPanel] (ChartPanel)
- [Tool Controllers] (Tool)
- [Login] (Login)
- [Logout] (Logout)
- [ChangePassword] (ChangePassword)
- Features
- Examples
- Developer's guide
- Library reference
- Frequently Asked Questions
- Kitto tips & tricks and how-tos
- Other information
- Kitto Enterprise