Article

Can I use filterMethod in a mobile application / How to disable the ability to add, delete and edit detail records

Question

1. Is it possible to use filterMethod for a detail (similarly to the main application), or in any way use an arbitrary filter and not just a filter based on the column of the parent page?

2. How to disable the ability to add, delete and edit detail records, depending on the values on the parent page?

Answer

1. For details, you can specify filters using the configure() method of the corresponding sdk-class:

Terrasoft.sdk.Details.configure("Contact", "ActivityDetailV2StandartDetail", {
   filters: Ext.create("Terrasoft.Filter", {
      type: Terrasoft.FilterTypes.Group,
      subfilters: [
         Ext.create("Terrasoft.Filter", {
            compareType: Terrasoft.ComparisonTypes.NotEqual,
            property: "Type",
            value: Terrasoft.GUID.ActivityTypeEmail
         })
      ]
   })
});

2. In general, changing the mode of detail operation is done like this:

Terrasoft.sdk.Details.setChangeModes("Contact", "ActivityDetailV2StandartDetail", [Terrasoft.ChangeModes.Read]);

But if you need to change the mode of operation based on the condition, then there is a getChangeModes() method for this purpose in the page controllers. In the controllers of the corresponding pages (grid, view, edit) you need to expand the following method:

getChangeModeOperations: function() {
   var detailConfig = this.getDetailConfig();
   if (detailConfig) {
      var parentRecord = detailConfig.parentRecord;
      if (parentRecord.get("IsNonActualEmail") === false) {
         return {
            canCreate: false,
            canUpdate: false,
            canDelete: false
         };
      }
   }
   return this.callParent(arguments);
}

 

Like 0

Like

Share

0 comments
Show all comments