Show most recently added item in remotely bound Kendo DropDownList

2 posts, 0 answers
  1. Infraestructura TI
    Infraestructura TI avatar
    5 posts
    Member since:
    Dec 2016

    Posted 26 Apr 2017 Link to this post


    I was wondering if there is a way to show the most recently added item in a Kendo DropDownList which is bound to a remote datasource (from a database, via an MVC action controller).

    I tried the following approach: in the same event that adds the item, once it is added, I try to set the method with the value of the last index; however, this fails, and I get some warning about a synchronous XMLHttpRequest.

    According to the research I have conducted, this happens because the script is trying to assign the index to the select method way too quickly, when the dataSource has not really been updated yet. If I try to assign the select method to a previous index (e.g. i - 1) and it does so without issue (showing the second-to-last item in the list). I assume this is because the item already exists in the database and thus there are no sync issues.

    I appreciate any ideas you guys can share regarding this issue.


  2. Stefan
    Stefan avatar
    2834 posts

    Posted 28 Apr 2017 Link to this post

    Hello Hector,

    Based on the provided information I can assume that this is indeed a timing issue.

    In this scenario, I can suggest using an event which indicates that the request is successful and the selected item is in the DropDown.

    I can suggest using the dataBound event of the DrowDown list, as this will ensure that the new data is already available in the DropDown list:

    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top