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

Cascading DropDownList MVVM Binding Problem

5 Answers 334 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Mirko
Top achievements
Rank 1
Mirko asked on 13 Jul 2015, 11:20 AM

Hello,

I have a problem when using cascading drop down lists and the MVVM source and value bindings. I created a demo here: http://dojo.telerik.com/EweGO/2

 

Selecting something in the first drop down ("province") causes the displayed value in the second drop down ("location") to update as expected. But even though both province and location are bound to the view model with the value binding only the province will actually be set on the view model as can be seen in the console log. So the location value does not change on the view model but is displayed in the view. It should be either empty or set in both. Is this a bug or am I missing something?

5 Answers, 1 is accepted

Sort by
0
Mirko
Top achievements
Rank 1
answered on 15 Jul 2015, 09:26 AM
There was a CORS problem in my original demo. I updated it accordingly and also tried to make the problem clearer by displaying the current view model values. You can find it here: http://dojo.telerik.com/EweGO/3
0
Georgi Krustev
Telerik team
answered on 15 Jul 2015, 09:41 AM
Hello Mirko,

The described issue is a known limitation of the cascading functionality. Basically, the widget will not trigger the "change" event (this is how the model is updated) when it is being filtered by a parent widget. The solution is to either trigger manually change event in dataBound event or use a custom MVVM binding that will do the same. You can find more details in the corresponding Github issue:
Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Mirko
Top achievements
Rank 1
answered on 17 Jul 2015, 10:17 AM

Thank you for your insights. Triggering change in the dataBound event makes the demo work as expected: http://dojo.telerik.com/EweGO/5

 

Side note: the correct GitHub issue appears to be https://github.com/telerik/kendo-ui-core/issues/661

0
Mark
Top achievements
Rank 1
answered on 03 May 2016, 11:04 PM
How do you pass the selected ID from the first Dropdown list to the cascaded dropdown list so it can call the web api(service) with the data from the first DDL?  I need to pass the id to fetch the data for the second ddl, then populate a form based on the selected value of the second ddl.  Thanks
0
Georgi Krustev
Telerik team
answered on 05 May 2016, 10:23 AM
Hello Mark,

You can use the datasource.transport.read.data callback option to send additional data back to server: If you have any difficulties, send us a repro demo showing the issue you have. Thus we will be able to review the case and follow you up with more details.

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