Is there a way to make a "Detail" read-only on mobile?
Hi, community.
Is there a way to make a "Detail" read-only on mobile?
I need to hide the "Add" and "Delete" buttons in "Detail" according to some rules.
I know that in the web version we can do this with the code below:
getAddRecordButtonVisible: function() {return false; },
editCurrentRecord: () => false,
getEditRecordMenuItem: Terrasoft.emptyFn,
getCopyRecordMenuItem: Terrasoft.emptyFn,
getDeleteRecordMenuItem: Terrasoft.emptyFn,
Thanks,
Tiago Pierine.
Like
Hi Tiago,
There is a getChangeModeOperations method for each page\view\gird controller and is specified in the following manner in the base page controller:
getChangeModes: function() { var changeMode = this.getChangeMode(); return Terrasoft.DataUtils.getChangeModeOperations(changeMode); }, /** * Returns change mode operations. * @protected * @return {Object} Change mode operations. */ getChangeModeOperations: function() { return this.getChangeModes(); }, /** * Returns change mode bit mask. * @protected * @virtual * @return {Number} Change mode bit mask. */ getChangeMode: function() { var detailConfig = this.getDetailConfig(); var changeMode; if (detailConfig) { changeMode = detailConfig.changeMode; } else { changeMode = Terrasoft.sdk.Module.getConfig(this.self.Model).changeMode; } return Ext.isNumber(changeMode) ? changeMode : Terrasoft.ChangeModes.All; },
So you need to create a controller for your page and extend the method in the way like below (it's an example, should be tested and debugged):
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); }
Best regards,
Oscar
Oscar Dylan,
Hi Oscar, thank you very much for the answer, would you have any examples of how to create a controller of this type? The section that I am using on mobile for this case is "Account".
Hi Tiago,
Unfortunately we don't have any instructions on this matter, you need to study how base controllers are created and create one for your section.
Best regards,
Oscar
Oscar Dylan,
Hi Oscar,
This code below is it only works for standard details?
Terrasoft.sdk.Details.setChangeModes("Contact", "ActivityDetailV2StandartDetail", [Terrasoft.ChangeModes.Read]);
I am trying to do it work for Embedded Detail but it is not working like the example below:
Terrasoft.sdk.Details.setChangeModes("UsrTributRetPortDetail", "UsrSchemad37cf1aeDetailEmbeddedDetail", [Terrasoft.ChangeModes.Read]);
Terrasoft.sdk.Details.setChangeModes("AccountAddress", "AccountAddressDetailV2EmbeddedDetail", [Terrasoft.ChangeModes.Read]);
Hi Tiago Martins Pierine, did you find the way to make the control with this functinoality?
Oscar can you tell us in what file you find the base code?
Federico Buffa ?,
Hi Federico, no, I couldn't get this to work.