Multiple binders precedence

5 posts, 0 answers
  1. Pascal
    Pascal avatar
    9 posts
    Member since:
    Mar 2016

    Posted 28 Oct Link to this post

    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,

  2. Stefan
    Admin
    Stefan avatar
    276 posts

    Posted 01 Nov Link to this post

    Hello Pascal,

    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
     
    Build rich, delightful, *native* Angular 2 apps with Kendo UI for Angular 2. Try it out today! Kendo UI for Angular 2 (currently in beta) is a jQuery-free toolset, written in TypeScript, designed from the ground up to offer true, native Angular 2 components.
     
  3. Kendo UI is VS 2017 Ready
  4. Pascal
    Pascal avatar
    9 posts
    Member since:
    Mar 2016

    Posted 03 Nov in reply to Stefan Link to this post

    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.

  5. Stefan
    Admin
    Stefan avatar
    276 posts

    Posted 07 Nov Link to this post

    Hello Pascal,

    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
     
    Build rich, delightful, *native* Angular 2 apps with Kendo UI for Angular 2. Try it out today! Kendo UI for Angular 2 (currently in beta) is a jQuery-free toolset, written in TypeScript, designed from the ground up to offer true, native Angular 2 components.
     
  6. Pascal
    Pascal avatar
    9 posts
    Member since:
    Mar 2016

    Posted 07 Nov Link to this post

    Hello Stefan,
    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,
Back to Top
Kendo UI is VS 2017 Ready