infinite datasource read loop

3 posts, 0 answers
  1. Boschi
    Boschi avatar
    13 posts
    Member since:
    Apr 2010

    Posted 30 Nov 2017 Link to this post

    Hi we have a problem with a combobox

    We need this combobox to have a lot of record (around 1000-2000) and to paginate results for performance. We also need it to have virtualization cause sometimes we have to use the value method to programmatically select an element that may not be in the current pagination.

    We then added a button at the left side. It opens a dialog that permits to add an element to the database, reread the combobox datasource and select the new element.

    // on confirm, call our add element rest api

        // on call completed,

             // on read promise completed, combobox.value( id of the new element )

             // combobox.trigger('change')


    the value( id ) method starts rereading the datasource non stop, doing infinite ajax get calls to the server. We are having troubles understanding what may cause this.

    in the console we read the warning i attached

    this is most of the code, tell me if you need other parts:

  2. Boschi
    Boschi avatar
    13 posts
    Member since:
    Apr 2010

    Posted 30 Nov 2017 Link to this post

    note that we found a random solution

    we noticed that calling read triggered the virtual.valueMapper twice, so we used a boolean variable to make it do his things only once

    this apparently solved the problem, but we really need to understand exactly what we're doing wrong

  3. Veselin Tsvetanov
    Veselin Tsvetanov avatar
    868 posts

    Posted 04 Dec 2017 Link to this post

    Hi Boschi,

    Attached you will find a .NET MVC project solution, which implements the described scenario. You will notice that on a click of a button a new item is added to the ComboBox DataSource, Then the Read action is triggered and the new item is successfully selected. You will notice, that these actions will not cause any errors.

    Concerning the two valueMapper calls, that you have observed, those are expected. The first one will hold the value selected before the newly added item gets selected, while the second will hold the new item value.

    Note, that the value mapper function relies on the order of the items in the list on the server. Therefore, the newly added item should always be added to the end of the list. Otherwise, issues as the observed may arise.

    As a side-note, I noticed, that in your project you are referencing jQuery 3.2.1. Keep in mind, that this latest version of jQuery has not been yet extensively tested against Kendo. Therfore, I would suggest you to use the latest officially supported version - 3.1.1.

    Veselin Tsvetanov
    Progress Telerik
    Try our brand new, jQuery-free Angular 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