Changing a button availabillity without updating the list (sandbox message implementation)
Question
My question concerns changing the button availabillity without updating the list – kindly advise where I can learn about the sandbox message implementation feature?
Answer
There are a lot of examples of sandbox message implementation in bpm'online. The BasePageV2 and BaseSectionV2 modules are some of them. In these modules, when performing initialization, we call the subscribeSandboxEvents() method that implements subscription to the sandbox messages.
For example, the [CardChanged] message subscription is implemented in the BaseSectionV2 module. When the module receives this message, it sets the modified value to the corresponding attribute. The message, on the other hand, sends (publishes) the BasePageV2 module when calling the publishPropertyValueToSection() method. The publishPropertyValueToSection() method, in its turn, is called when certain attributes of the edit page model are modified.
You can act in a similar way. For example, subscribe to the modification of the [ServiceCategory] field in the init() method of your edit page (CasePage):
init: function() { this.callParent(arguments); this.on("change:ServiceCategory", function(model, value) { this.publishPropertyValueToSection("CurrentServiceCategory",value); }, this); }
Thus, when the [ServiceCategory] page field is modified, the new value will be populated in the [CurrentServiceCategory] attribute of the CaseSection section.
After this, you will be able to receive the current category value by addressing the [CurrentServiceCategory] attribute:
isEnableButtonColumbus: function() { var serviceCategory = this.get("CurrentServiceCategory"); if (!serviceCategory) { // Ваш код } else { return (serviceCategory.value ===UsrConsts.ServiceCategory.Dynamix); } }