jQuery UI Widgets › Forums › DataTable › UpdateRow Commit Problem
Tagged: addrow, ajax, async, CRUD, data table, datatable, jqxdatatable, reset, send to sql server, server, server-side, updaterow
This topic contains 3 replies, has 3 voices, and was last updated by Dimitar 8 years, 2 months ago.
-
AuthorUpdateRow Commit Problem Posts
-
updaterow: function (rowID, rowData, commit) { $.ajax({ type: "POST", dataType: 'json', cache: false, async: false, url: '/api/order/update', data: rowData, success: function (data, status, xhr) { commit(true); } }); },
Here is my code. if I set async to true, it’s not showing the changes unless I refresh the page.
Hello drtzack,
Note that the name of the data table source callback is updateRow, not updaterow. Please correct this and share if the issue persists.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Can anybody help me to with what i need to write to get on server the add edit reset row ?
updaterow: function (rowid, rowdata, commit) {
//synchroniza with the server – send update command
data = “update=true” +
“&ID_CUSTOMERS=” + rowdata.ID_CUSTOMERS +
“&CompanyName=” + rowdata.CompanyName +
“&ContactTitle=” + rowdata.ContactTitle +
“&City=” + rowdata.City +
“&Country=” + rowdata.Country +
“&Address=” + rowdata.Address +
“&DateOfBirth=” + rowdata.DateOfBirth;
//rowdata.id = rowid;$.ajax({
dataType: ‘json’,
//cache: false,
url: ‘WebService1.asmx/GetCustomers’,
data: rowdata,
type: “POST”,
success: function (data, status, xhr) {
// update command is executed.
commit(true);
//commit(true, data.id);
alert(‘Worked!’);
},
error: function (jqXHR, textStatus, errorThrown) {
// update failed.
commit(false);
alert(‘Did not work’);
commit(true);
}
});},
addrow : function (rowid, rowdata) {
var observableArray = self.myData.arrayA,
record = null;
observableArray.push({ dateFrom: null, dateTo: null, duration: null, text: null, code: null, currency: null });
record = observableArray()[rowid];
for (var obj in record) {
record[obj] = ko.observable(record[obj]);
}
ko.mapping.fromJS(observableArray(), {}, self.myData.arrayA());
}deleterow : function (rowid) {
var observableArray = self.myData.arrayA;
observableArray.remove(observableArray()[rowid]);
}I need to write anything else on default.aspx.cs to can see on the server sql?
Hello edd,
Please note my previous post in this topic. If you are using jqxDataTable, the source callback functions in question are called updateRow, addRow and deleteRow. Please also note that there has to be a comma between the definitions of addRow and deleteRow.
You can see a working CRUD example (but with jqxGrid) that features both client- and server-side implementations here: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/asp.net-integration/asp.net-grid-crud.htm.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.