This is a migrated thread and some comments may be shown as answers.

How to add value to multiselect with virtual value?

3 Answers 561 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Huynh
Top achievements
Rank 1
Huynh asked on 25 Apr 2017, 06:48 AM

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!

3 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 26 Apr 2017, 06:53 AM
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.
0
Huynh
Top achievements
Rank 1
answered on 27 Apr 2017, 10:35 AM

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.

0
Ivan Danchev
Telerik team
answered on 28 Apr 2017, 01:01 PM
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.
Tags
MultiSelect
Asked by
Huynh
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Huynh
Top achievements
Rank 1
Share this question
or