I have a Kendo datasource that is not bound to a Kendo object; I am using the data in a plain old HTML textarea.
I would like to have the user modify the text in the text area, then hit a save button to apply the new data. I've linked the save button to a javascript function that calls dataSource.update() and gets the new data from the textarea. Of course, this doesn't work.
My question is: how do I get the dataSource to update since there is no update() method?
I would like to have the user modify the text in the text area, then hit a save button to apply the new data. I've linked the save button to a javascript function that calls dataSource.update() and gets the new data from the textarea. Of course, this doesn't work.
My question is: how do I get the dataSource to update since there is no update() method?
5 Answers, 1 is accepted
0
David
Top achievements
Rank 1
answered on 20 Aug 2012, 09:56 PM
Nothing, eh? :-)
Seriously: how do I force my dataSource to update?
Seriously: how do I force my dataSource to update?
0
Hello David,
The sync method will send the updated records to the remote service.
All the best,
Atanas Korchev
the Telerik team
The sync method will send the updated records to the remote service.
All the best,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David
Top achievements
Rank 1
answered on 21 Aug 2012, 03:11 PM
I'm missing something here.
Upon clicking the "Save" button I need to tell the dataSource to update. What I'm doing is setting a value in the dataSource to try to tell it that its value is updated, then calling sync(). Problem is this does nothing.
Here's the function that is called by the save button:
The first statement updates the value, the second tells it to update. I must be doing the first step wrong because sync does nothing; the dataSource doesn't appear to know that it needs to update.
Upon clicking the "Save" button I need to tell the dataSource to update. What I'm doing is setting a value in the dataSource to try to tell it that its value is updated, then calling sync(). Problem is this does nothing.
Here's the function that is called by the save button:
function
saveNotes() {
notes_datasource.data()[0].o_notes = document.getElementById(
"o_notes"
).value;
notes_datasource.sync();
};
The first statement updates the value, the second tells it to update. I must be doing the first step wrong because sync does nothing; the dataSource doesn't appear to know that it needs to update.
0
David
Top achievements
Rank 1
answered on 21 Aug 2012, 03:16 PM
Oh brother. How about this:
Works now.
function
saveNotes() {
notes_datasource.data()[0].dirty =
true
;
notes_datasource.sync();
};
Works now.
0
Alexander Jiménez
Top achievements
Rank 1
answered on 14 May 2019, 06:17 PM
Yes this technique of setting the row to dirty worked. Now the sync() method is sending the data.