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

Removing items

2 Answers 311 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 28 May 2012, 10:54 AM
Hi,

I've been racking my head around this one for a while and simply can't figure out how to do it.

I've got a drop down list, and simply want to remove an item from it. I'm binding the drop down list in MVVM using the options binding to an array, which works fine.

Now, whenever I try to remove an item from this array, MVVM should auto-bind the options to the Drop down list and update the items. This, however, is not the case. I've also tried calling .refresh() on the drop down list to no avail.

I've tried doing this the jQuery way by removing individual li elements from the original <select> in my HTML, and then calling .refresh. This, again, does not work.

Are there any ideas out there in how I can achieve this? .filter etc is not valid for my scenario, I want to do this via an array that isn't going back and forth from the server.

2 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 04 Jun 2012, 02:48 PM
Bumping this - surely there has to be a way of removing items from a Kendo Dropdownlist?!
0
Georgi Krustev
Telerik team
answered on 05 Jun 2012, 07:22 AM
Hello Chris,

 
You will need to remove the item and set the data of the DropDownList's dataSource. You can use the data method for this. Check this jsFiddle demo, which shows how to achieve this.

Please note that we do not guarantee answers in the forums. I will suggest you open support threads for the next technical issues. Thus the support team will be able to help you faster.

All the best,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
DropDownList
Asked by
Chris
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or