jQWidgets Forums
jQuery UI Widgets › Forums › DataTable › DataTable addRow commit callback null
This topic contains 1 reply, has 1 voice, and was last updated by James Lavery 10 years, 5 months ago.
-
Author
-
I’m trying to implement DataTable editing, according to the samples. My problem is that my DataTable isn’t updating – I think it’s because the commit callback being passed to addRow, updateRow etc. is null.
The code for my source is below:
var source = { type: "POST", datatype: "json", datafields: [ { name: 'Id', type: 'int' }, { name: 'Code' }, { name: 'Name' }, { name: 'Description' }, { name: 'Value', type: 'float' }, { name: 'VatRate', type: 'float' } ], id: 'Id', url: endpointURL, cache: false, root: 'data', addRow: function (rowID, rowData, position, commit) { // synchronize with the server - send insert command // call commit with parameter true if the synchronization with the server is successful // and with parameter false if the synchronization failed. // you can pass additional argument to the commit callback which represents the new ID if it is generated from a DB. commit(true); }, updateRow: function (rowID, rowData, position, commit) { //synchronize with the server - send insert command //call commit with parameter true if the synchronization with the server is successful //and with parameter false if the synchronization failed. //you can pass additional argument to the commit callback which represents the new ID if it is generated from a DB. commit(true); }, };
Note that I haven’t got my server update code included above, for clarity. When I put a breakpoint on any of the commit(true) lines, the commit callback is null.
What do I have to set up with my DataAdapter or DataTable for the commit callback to be defined? Do I have to suppy this myself?
Found the problem – a copy/paste error. I’d got too many parameters for my updateRow definition – it should be
updateRow: function (rowID, rowData, commit) {
not
updateRow: function (rowID, rowData, position, commit) {
-
AuthorPosts
You must be logged in to reply to this topic.