DropDownList and MVVM loads double

3 posts, 1 answers
  1. Jaap
    Jaap avatar
    96 posts
    Member since:
    Oct 2012

    Posted 26 Mar 2012 Link to this post

    I have a dropdownlist with the data-bind attribute set to {value: myfield} and data-source attribute set to {"transport":{"read":"myurl"}} (and the data-role of course).
    It is loading the datasource 2 times (2 requests to the server). I think that the first time the data is read on creation of the DataSource and the second time when the value is binded. But I am not sure about that. I saw that the second time does not occur when myfield is empty.
    Hope you can reproduce this with this info, if not I will take some time to create simple repro.

    Regards, Jaap
  2. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 26 Mar 2012 Link to this post

    Hi Jaap,

    The second request in the described scenario is caused by the fact that when setting the value and the DropDownList is not yet populated, it will issue a query through the DataSource to populate itself. The DropDownList is not populate at this point as the response from the first request is not yet received. Usually this behavior is prevented by setting autoBind option of the DropDownList to false. Unfortunately, in the current version of MVVM this option will not take effect when widget is created declarative and the DataSource is a MVVM property. This we have already addressed, and the fix will be available in the internal builds and also with the next service pack.

    Regards,
    Rosen
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Jaap
    Jaap avatar
    96 posts
    Member since:
    Oct 2012

    Posted 26 Mar 2012 Link to this post

    Ok, thank you.
    Jaap
Back to Top