Checked and Clicked Binding problem

12 posts, 0 answers
  1. Steve
    Steve avatar
    1885 posts
    Member since:
    Dec 2008

    Posted 10 Feb 2013 Link to this post

    Reference this demo: http://demos.kendoui.com/web/mvvm/elements.html

    Okay so when a checkbox is checked, the array gets updated right...

    Then when the array changes, I need to fire off a callback to a service, AND update the checkbox by adding\removing a class.

    What seems to happen is that the click event fires first, so the callback doesn't send back the proper values from the array (like I'm always one selected value behind).

    ?

    Steve
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 12 Feb 2013 Link to this post

    Hello Steve,

    The array should be updated immediately when a checkbox is selected and the UI is updated after that. Here is a JSBin example which shows that the array is updated accordingly to the selection which was made.

    http://jsbin.com/igirur/2/edit

    Regards,
    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Steve
    Steve avatar
    1885 posts
    Member since:
    Dec 2008

    Posted 12 Feb 2013 Link to this post

    Try this one instead: http://jsbin.com/igirur/4/edit

  4. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 14 Feb 2013 Link to this post

    Hello Steve,

    I am not sure I understand the question, can you please explain in more details what exactly is the issue with the example you shared?


    Kind Regards,
    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Steve
    Steve avatar
    1885 posts
    Member since:
    Dec 2008

    Posted 14 Feb 2013 Link to this post

    OH!...I assume you tried it in chrome and it's fine

    ..try Firefox
  6. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 18 Feb 2013 Link to this post

    Hello Steve,

    The order of the events being triggered is different.

    Same is happening here try with different browsers again:

    http://jsbin.com/anafev/2/edit

    Kind Regards,
    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  7. Steve
    Steve avatar
    1885 posts
    Member since:
    Dec 2008

    Posted 19 Feb 2013 Link to this post

    I know, I'm not exactly sure what you're telling me here...I'm reporting the one reporting the events are firing at different times on different browsers?

  8. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 21 Feb 2013 Link to this post

    Hello Steve,

    There is not any kendo code in this example and the events are fired in different order. And since Kendo depends on the order in which the events are fired, Kendo will behave the same way as the events are fired.

    There is nothing we can do to change the order of the events in the different browsers.

    All the best,
    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  9. Steve
    Steve avatar
    1885 posts
    Member since:
    Dec 2008

    Posted 21 Feb 2013 Link to this post

    There's no way for kendo to account for this...not even file something with mozilla...orr....anything, I'm just screwed here?
  10. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 25 Feb 2013 Link to this post

    Hello again Steve,

    As I already replied in my previous post I am sorry but there is nothing we can do.

    Regards,
    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  11. Keith
    Keith avatar
    24 posts
    Member since:
    Sep 2011

    Posted 03 May in reply to Petur Subev Link to this post

    Is this still the case?  If so wow!  So in Chrome, the click event's reading of the bound vm value is the original value, then after the click finishes the binding is updated to the new value.  Yet in IE, the binding update is made prior to the click event.  Fascinating!  

    What is the best way to read the desired value during the click event, something of the parameter, I'll call 'e'?

  12. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    975 posts

    Posted 07 May Link to this post

    Hello Keith,

    As Petur has explained previously, the Kendo implementation depends on the browser event sequence. If the different browsers follow different sequence for those events (Chrome and Firefox vs IE and Edge), there is nothing much we can do.

    As per the scenario that has been previously discussed, an ugly (but working) workaround would be to timeout the execution of the logic in the click handler. This way, the value will be changed accordingly independent from the event sequence:
    filterChanged: function (e) {
      setTimeout(function() {
        clickFilter.html($restViewModel.displayselectedFilters());
      });
    }

    Here you will find a sample Dojo implementing the above.

    Regards,
    Veselin Tsvetanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top