Hello,
We would like to know how to configure kendo for a given model binder to be the last of all the binders executed when a property is bound to multiple custom binders ?
E.g.:
<div data-bind="customBinder1:someAction, enabled:someOtherAction, customBinder2:anotherAction, value:someProperty"></div>
How to ensure customBinder2 will ALWAYS be the last one to refresh the dom element state ?
Regards,
4 Answers, 1 is accepted
The binding order in MVVM cannot be specified, which is MVVM specific and the Kendo UI team has no control over it.
If you share more details for the scenario, we can investigate if there is another approach which can be used to achieve the desired result.
Regards,
Stefan
Telerik by Progress
Hello Stefan,
Thank you for your help.
Our scenario is that we would like to enable/disable widgets based on presence of given permissions in the model.
To do so we want to centralize the logic in a custom permissions binder.
If this binder is not the last to be executed we can go into troubles because there is another binder enabling/disabling widgets based on model state in addition to the model itself (which have custom methods plugged either to enable or disable binding)
Let say we have the following markup:
<div role="button" data-bind="enable:EnableButtonIfReadyForNextStep, permissions:{Roles:'A,D', Edit:'B,C'}"></div>
Our idea is to have the following execution order :
1) EnableButtonIfReadyForNextStep is executed to enable or disable or button
2) Another binder not explicitely mentionned in the button markup may be run to deactivate the button
3) Lastly, our permissions binder will run to deactivate the button if it is enabled and does not have any of the edit role in its roles.
- If EnableButtonIfReadyForNextStep runs after permissions binder has disabled widget it's not correct.
- If our other binder not mentionned in the markup enable the widget after the permissions binder it's not correct either.
After testing the different custom binders and inspecting the implementation, I can confirm that the order of the custom binders depends on the order in which they are set.
Please check the following example using three custom binders and noticed that changing the order in which they are set will also change the order in which they are bound:
http://dojo.telerik.com/AzUgi
I hope this will help to achieve the desired result and ensure the desired order.
Regards,
Stefan
Telerik by Progress
I came to the same conclusion by digging in the sources.
Yes this help achieving the desired result.
Anyway thank you for your help.
Regards,