jQuery UI Widgets › Forums › Grid › jqxGrid rowupdate commit(false) – any way to resume user edits?
Tagged: jquery grid widget, RESTful service
This topic contains 2 replies, has 2 voices, and was last updated by mdiamond 9 years, 7 months ago.
-
Author
-
September 18, 2015 at 10:11 pm jqxGrid rowupdate commit(false) – any way to resume user edits? #76000
Hello,
I have a jqxGrid with{ editmode:'selectedrow' }
When the user clicks off the row, the following updaterow logic fires on the dataAdaptor:
`updaterow: function (rowid, rowdata, commit) {
// synchronize with the server – send update command
var data = rowdata;
var result = httpcall_sync(“PUT”, data, env_constants.DATASERVICES_URL + “/ar_invoices/” + rowdata.arInvoiceID);
commit(result);
}`(httpcall_sync serializes the data & sends an HTTP transaction to the service, returns true if it worked. If it failed it displays the error from the server and returns false.)
The question is how to handle errors. What we’d like is for the user to fix the data and try to save again. Unfortunately commit(false) reverts their changes. Not calling commit at all clears the editable fields of the row.
Is there a way to tell the grid that the user edit should continue? I’m starting to think I’ll have to use a popup window for the edit instead, but if there’s a way to do the original approach I’d be interested in knowing how.
September 19, 2015 at 7:21 am jqxGrid rowupdate commit(false) – any way to resume user edits? #76005Hi mdiamond,
Implement the columns validation functions so users will be able to submit only valid results.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/September 21, 2015 at 12:54 pm jqxGrid rowupdate commit(false) – any way to resume user edits? #76050Thanks for the quick reply.
I recognize that implementing column validations in the client is a valid approach for some projects, but in our project the backend is a a RESTful service that must validate everything sent to it. So we’d rather keep the client validations to a minimum rather than duplicate all the validations. (This also reduces the amount of data the client needs to fetch.)
Given this design constraint, back my original question. The two options I’m seeing are:
1) Use a popup window to edit the row.
2) Let the user leave the row but mark it edited. Keep track of all changed rows, and put a Save button under the grid. The Save function would update each row as it gets successfully saved.Comments welcome.
-
AuthorPosts
You must be logged in to reply to this topic.