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

Unable to clear values programmatically when using virtualization

4 Answers 283 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 04 Feb 2016, 07:41 PM

I am trying to clear values in a MultiSelect widget that utilizes virtualization. If I filter to an item that is outside of the initial data load and attempt to clear the value via javascript I get the error "Uncaught TypeError: Cannot read property 'item' of undefined" after the MultiSelect refreshes. If I open the MultiSelect after selecting the value, the valueMapper function fires and the error does not occur when I clear the items. I am able to reproduce this error using a modified version of the virtualization demo. It seems like the difference between the two is that the paging variables are not reset when the window is closed. This sounds similar to a previous thread that related to the filter not being reset on close. 

Here are the steps to reproduce:

  1. Filter the multi select to a value that is outside of the initial load.
  2. Select the value.
  3. Close the multi select list.
  4. Click the Clear Orders button.

If I could manually fire the valueMapper function for the MultiSelect then I could create a workaround. Any suggestions on a workaround would be appreciated. My experience overall with the way virtualization is handled in this control suite has not been very good. It would be helpful to have more of the virtualization areas exposed similar to what is available in the dataSource object.

4 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 08 Feb 2016, 05:36 PM
Hello Ben,

Thank you for bringing this to our attention. I logged this as a bug in Kendo UI Core bug tracker, you can use this link to follow the issue status.
There is no easy workaround as the valueMapper function cannot be called manually. We will do our best to provide a fix as soon as possible.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Jayamurugan
Top achievements
Rank 1
answered on 15 Mar 2016, 08:32 PM

Hello Alexander Valchev,

Also, if the selected value's index outside of the initial load, the selected values are getting duplicated.

 

Regards,

A.Jayamurugan

0
Jayamurugan
Top achievements
Rank 1
answered on 15 Mar 2016, 08:37 PM

sorry i missed to mentioned the below

the selected values are getting duplicated when we delete it.

steps.

1. Select the options,

2. save the selected options

3. Load the selected options and set the selected options using below statements

  var operatorDropDown = $("#Operator").data("kendoMultiSelect");
        operatorDropDown.dataSource.filter({});
        operatorDropDown.value(currentQuery.operators);

4. The values are getting selected

5. Delete the selected options by clicking 'X' Button

now see the duplicate options where their index is out of initial load.

 

Regards,

A.Jayamurugan

 

0
Alexander Valchev
Telerik team
answered on 18 Mar 2016, 07:48 AM
Hello Jayamurugan,

Is it possible to reproduce the issue in the MultiSelect virtualization page?

I noticed that you are using the filter method of the dataSource to clear the filters. Controlling the widget's dataSource via the API methods in virtualization mode is not supported. Virtualization logic relies heavily on the dataSource which is why only the widget should modify it.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
MultiSelect
Asked by
Ben
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Jayamurugan
Top achievements
Rank 1
Share this question
or