Custom syncing of several DDLs

5 posts, 0 answers
  1. Cristian
    Cristian avatar
    8 posts
    Member since:
    Nov 2014

    Posted 12 May 2015 Link to this post

    So, I am using UI for ASP.NET MVC Q1 2015. I have 3 DDLs, configured to populate their data remotely(from action method inside a controller) using DataSource/Read action AJAX pattern.

    I have some custom business logic I need to implement: when something gets changed in the 1st DDL, I have to do some custom calculations that may potentially involve what it has been selected in 2nd DDL so I can eventually change the selected values in the 3rd DDL.
    So this here has nothing to do with datasource filtering or custom cascading.

    My issue/concern here is: how can I do any such calculations/alterations of the other DDLs from inside a 'Changed' event handler in the 1st one safely, given all 3 are populated asynchronously? I mean, how can I be sure that when inside the Changed event handler in 1st DDL, data for 2nd & 3rd DDL had been fully loaded so I can use them in calculations and/or change the Selected value for those DDLs?

    Thanks!

  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 14 May 2015 Link to this post

    Hello Cristian,

    The DropDownList will fire its dataBound event, when the data from the remote service is ready. So in your case you can listen for that dataBound event in order to be sure that the data is loaded. Here is the documentation about it:

    http://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist#events-dataBound

    Regards,
    Kiril Nikolov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Cristian
    Cristian avatar
    8 posts
    Member since:
    Nov 2014

    Posted 14 May 2015 in reply to Kiril Nikolov Link to this post

    Thanks Kiril for your answer.  Not sure if I explained my scenario well enough, because I was well aware about dataBound event. But would not that mean I have to handle this event for DDL 2 & 3, change some global flags for this and then, somehow use them when handling the Change event for DDL 1? And what if data is not ready in DDL 2 and 3 to query for selections made there yet, means I would have to implement some sort of polling logic in in Change event for DDL 1.

    All this sounds awfully tedious. Is there really no other way?

  5. Cristian
    Cristian avatar
    8 posts
    Member since:
    Nov 2014

    Posted 14 May 2015 in reply to Kiril Nikolov Link to this post

    Thanks Kiril for your answer.  Not sure if I explained my scenario well enough, because I was well aware about dataBound event. But would not that mean I have to handle this event for DDL 2 & 3, change some global flags for this and then, somehow use them when handling the Change event for DDL 1? And what if data is not ready in DDL 2 and 3 to query for selections made there yet, means I would have to implement some sort of polling logic in in Change event for DDL 1.

    All this sounds awfully tedious. Is there really no other way?

  6. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 15 May 2015 Link to this post

    Hello Cristian,

    The dataBound event is the only way to get notified when the data is loaded, so there is no other way to achieve what you are looking for.

    Regards,
    Kiril Nikolov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET MVC is VS 2017 Ready