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

Grid data set by JQuery lost during inline edit

1 Answer 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carey
Top achievements
Rank 1
Carey asked on 22 Jan 2015, 10:28 PM
I have a pretty simple grid, which includes 6 select boxes. I've attached a JQuery listener to the first select box so that when a value is selected, I make an ajax call to return the values for the remaining 5 select boxes. I use JQuery to set their values, visually everything looks peachy, but as soon I click Update on the row, all of my JQuery set values disappear and the record updates without them. 

If I manually select all the select boxes, they update fine. I've inspected the HTML for both situations, dynamically and manually set data, and I don't see any difference. 

What am I missing?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 24 Jan 2015, 02:44 PM
Hello Curtis,

When you update the form fields inside the Grid programmatically, the widget is not aware of this. As a result, the underliying data items are not updated either, and when the Update button is clicked, there is nothing to update. The editing mechanism does not take the form field values when the Update button is clicked. Instead, it relies on MVVM and two-way binding, which updates the data item when a change event of a form field is fired. That's why you can trigger this event manually for each form controls that has its value changed via script.

$("selector").val("value").trigger("change");


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