This question is locked. New answers and comments are not allowed.
Telerik Guru's,
I am having an issue trying to get a treeview that uses client side binding with real data to post the checkedNodes values back to the controller. The demo example for client side binding is not suitable for me because it uses static data typed right into into the view and I need to fetch my data from the database. The demo for the checkboxes is binding directly to a model and doesnt demonstrate how to use them without binding immediately to the model.
I have modified an example project from an earlier post by adding a new view, "ClientBindPostBackCheckNodes", which demonstrates my problem. You can contrast it to the working version in the second link which demonstrates it working correctly when binding to a model. If you put a breakpoint at line 67 of the homecontroller, you will see that the checkedNodes parameter is always null whenever you post from the client bound version.
The main difference and culprit is the binding. I'm binding using an ajax method because the real application im working on will use a dropdown as a filter for the treeview. I catch the OnChange event of the dropdown, send the selected value to an ajax method which returns a json object, and then bind the treeview to that object. I'm using a .bindTo(data) method, which I just realized is undocumented. The documentation lists a .dataBind(data) method but when I attempt to use it, I get an error in the telerik.treeview.min.js file. I must have found .bindTo() in another example project.
Can someone please modify the attached project to demonstrate how to properly perform the scenario listed above or even just to get the ClientBindPostBackCheckNodes view to provide the checkedNodes paramater to the controller?
Thanks in advance.
Other questions that could be answered in the demo:
How to set the mapping for children when using client side binding and dynamic data? In the example, each level is a is a different type.
If I had a tree with 20 levels of hierarchy(each level is same type, i.e.from self-referencing table), how would you define that binding?
Can someone provide documentation for the .bindTo(data) method.
I am having an issue trying to get a treeview that uses client side binding with real data to post the checkedNodes values back to the controller. The demo example for client side binding is not suitable for me because it uses static data typed right into into the view and I need to fetch my data from the database. The demo for the checkboxes is binding directly to a model and doesnt demonstrate how to use them without binding immediately to the model.
I have modified an example project from an earlier post by adding a new view, "ClientBindPostBackCheckNodes", which demonstrates my problem. You can contrast it to the working version in the second link which demonstrates it working correctly when binding to a model. If you put a breakpoint at line 67 of the homecontroller, you will see that the checkedNodes parameter is always null whenever you post from the client bound version.
The main difference and culprit is the binding. I'm binding using an ajax method because the real application im working on will use a dropdown as a filter for the treeview. I catch the OnChange event of the dropdown, send the selected value to an ajax method which returns a json object, and then bind the treeview to that object. I'm using a .bindTo(data) method, which I just realized is undocumented. The documentation lists a .dataBind(data) method but when I attempt to use it, I get an error in the telerik.treeview.min.js file. I must have found .bindTo() in another example project.
Can someone please modify the attached project to demonstrate how to properly perform the scenario listed above or even just to get the ClientBindPostBackCheckNodes view to provide the checkedNodes paramater to the controller?
Thanks in advance.
Other questions that could be answered in the demo:
How to set the mapping for children when using client side binding and dynamic data? In the example, each level is a is a different type.
If I had a tree with 20 levels of hierarchy(each level is same type, i.e.from self-referencing table), how would you define that binding?
Can someone provide documentation for the .bindTo(data) method.