Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combobox Cascading need more specific cascadeFrom option

Tags:

kendo-ui

I want to use the cascadeFrom feature of the Kendo UI ComboBox, but to my dismay it seems that that option will only accept an ID. Now I can't use the ID because the combobox is added dynamically and possibly multiple times resulting in multiple controls with the same ID.

Does anyone have any ideas on how I can either pass a specific dom object to the cascade or how I could possibly setup a custom cascade feature using the 'change' event?

like image 577
Zholen Avatar asked Dec 12 '12 20:12

Zholen


Video Answer


1 Answers

That cascading functionality is just some sugar to make it easier create cascading DropDowns/Combos.

Basically you need to use 4 things to manually implement yourself that fancy cascading-> change event of the parent ComboBox, enable method of the child ComboBox,value method of the parent ComboBox and the dataSource.read() method of the child ComboBox.

Initially the child is enabled(false) when the change event of the parent is triggered get the value of the parent and pass it to the read method of the child dataSource.read() method to send it to the server. Finally return the needed records from the server.

function OnChangeOfParentCombo(e){
     var child = $('#ChildCombo').data().kendoComboBox;
     child.enable(true);
     child.dataSource.read({myFilter:this.value()});
}
like image 132
Petur Subev Avatar answered Oct 20 '22 04:10

Petur Subev