How to add value to multiselect with virtual value?

4 posts, 0 answers
  1. Huynh
    Huynh avatar
    2 posts
    Member since:
    Feb 2015

    Posted 25 Apr 2017 Link to this post

    I have a multiselect that list selection is too much value, so I use virtual to load them. I suppose that I load each 80 items, I select the first item to multiselect, then select the 85th item. After I reload the page contain multiselect, only the first item is selected. The multiselect value still has 2 items that I selected, but only 1 is shown to the textbox.

    How to fix this issue? Thanks!

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    1888 posts

    Posted 26 Apr 2017 Link to this post

    Hello Huynh,

    The MultiSelect is not designed to persist selected items on page reload. Therefore if you want it to show selected items after reloading the page you can call its value method in a document-ready handler and pass the desired values to the method, for example:
    $(document).ready(function () {
        var multiselect = $("#multiselect").data("kendoMultiSelect");
        multiselect.value(["1", "2"]);
    });


    Regards,
    Ivan Danchev
    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.
  3. Huynh
    Huynh avatar
    2 posts
    Member since:
    Feb 2015

    Posted 27 Apr 2017 Link to this post

    Your answer doesn't solve my issue. Okay, I will write it more clearly. I have a multiselect that uses virtual to load each 80 items per page. And I want to select 15th item and 85th item programmatically. I wrote code same as you, but only the 15th item is selected.

  4. Ivan Danchev
    Admin
    Ivan Danchev avatar
    1888 posts

    Posted 28 Apr 2017 Link to this post

    Hello Huynh,

    Here's a sample dojo, which demonstrates the previously suggested approach. The values of the 15th and the 85th items are passed to the MultiSelect's value method and both items are selected. Let me know if I am missing something with regard to what your are trying to achieve.

    Regards,
    Ivan Danchev
    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