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

Unable to remove item from kendo dropdownlist programmatically

1 Answer 168 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Stanley
Top achievements
Rank 1
Stanley asked on 01 Oct 2012, 01:53 PM
       The following two methods for trying to programatically remove an item from a kendo dropdownlist were taken directly from Kendo forums but did not work. Both methods caused the dropdownlist to vanish entirely from the UI.   The dropdownlist is defined in the header of a kendo grid control.    I have verified that the _selectedLoosePartIndex value is good.        Have to say that so far this product has cost me weeks of additional programing time trying to do the most simple tasks imaginable.   I have no idea why it is such a popular product.   I really do not believe that you guys have even attempted to thoroughly test the API in real world applications.      
  //Method one:
var data = $('#AvailableLooseParts').kendoDropDownList().data("kendoDropDownList").dataSource.data();  
 data = data.splice(_selectedLoosePartIndex, 1);
      $('#AvailableLooseParts').kendoDropDownList().data("kendoDropDownList").dataSource.data(data);

    
// Method two:
        var ddl = $('#AvailableLooseParts').data("kendoDropDownList");
        var itemToRemove = ddl.dataSource.at(_selectedLoosePartIndex);
        ddl.dataSource.remove(itemToRemove);
        ddl.select(0);

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 04 Oct 2012, 12:14 PM
Hi Stanley,

 

I prepared a small sample based on the Method two (please find it attached to the current thread) which removes an item from the DropDownList on button click. Could you please check it and let me know how it differs from your real setup?

Kind Regards,
Vladimir Iliev
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
Stanley
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or