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

Problem in rendering Items after adding and removing values

1 Answer 117 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
eliraz
Top achievements
Rank 1
eliraz asked on 17 Jul 2013, 01:18 PM

Hi,

I'm trying to build a kendo window which includes both grid and multiselect controls, 
and to allow by double clicking on a row in the grid to add the clicked item to the multi select (Lets say that "id is the value and "name" is the text).
After clicking on the item in the grid I'm trying to append this new value  to the multi select using its api (using the "value" function).
Afterwards,  I remove some of the values I've just added using the control itself (clicking on the "X" of the item) and adding the same items again.
The initial dataSource of the multi select control is an empty array, while it's being changed when new values are added.
I check if the new value I just got from the grid is already exists in the datasource and in the value array, otherwise I add it first to the datasource and then to the value array.

When I made all the mentioned above, I found out that adding an item which had been removed before will hide/remove all the other items and the control would only display the last item added, while the value array still contains all the other ones.
On the "change" event that is triggered by deleting this item, I watch at the value array and see that it's not been changed (this value is still there).
Performing these steps over and over, the value list apears to have duplicates at the same amount as the selected items from the grid (distinct values).

Thanks

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 19 Jul 2013, 08:40 AM
Hello Eliraz,

I am not sure how your implementation goes since you did not share any code. However here is an example that I created from your explanation.

It is working correctly on my side. I hope it helps.

http://jsbin.com/opunef/2/edit


Regards,
Petur Subev
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
eliraz
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or