I'm using a Kendo MVC DropDownList with cascading programmatically. I have my Orders DropDownList as an editor template for the Kendo Grid row. The values in the Orders DropDownList are dependent upon the selected value from the Customer dropdown in the same grid row. The Customer dropdown is a searchable control with no values bound initially.
My grid is set up to invoke a JavaScript method on editing a row, like this:
.Events(e => e
.Edit("onGridEdit")
.DataBound("onGridDataBound")
.Save("onGridSave"))
In my onGridEdit JavaScript method, I read my Customer dropdown like this:
custCtrl.dataSource.read({ text: dataItem.CustomerId });
This will read a unique customer from the DB and binds to Customer dropdown.
Now I would like to get the corresponding list of values in the Orders dropdown based on this selected CustomerId, which is done like this:
// own version of cascade;
orderCtrl.dataSource.read({ customerId: dataItem.CustomerId });
This return might take few seconds; hence I need to set a callback function for this read programmatically so that I can set the selected value for the Order dropdown with the value from the editing row. How can I do it?