Title: Server database processing no validation hook for edatagrid extension Post by: frapa02 on January 06, 2012, 06:07:56 AM There appears to be no facility in the edatagrid plugin server call to check for a response from the server program which performs the database processing. I have worked around the problem for the get data by passing any error messages into one of the grid fields. However, I need something to allow me to return details to the user properly if there was a problem in the server processing. This is available in the normal datagrid and form approach. Adding this will be very important for live data interfaces. I should be able to figure out how to change the plugin but if anyone has any thoughts or suggestions please let me know.
For example, for updates / inserts we need to add some code to test the returned data after line 34 in jquery.edatagrid.js: $.post(url, row, function(data){ Paul. Title: Re: Server database processing no validation hook for edatagrid extension Post by: tclemmer on April 25, 2012, 10:46:36 AM I am not a very capable javascript programmer but here is what we added.
Add this after the line "data.isNewRecord = null;" in the onAfterEdit section if(data.error_message != ""){process_table_error(data.error_message)}; This requires you to make sure that first element in your returned JSON is "error_message" with a value of "" for now error. If you have an error, pass "error_message" with the value of your error message. Then in your javascript section of your page add: function process_table_error(error_msg){ $.messager.alert('Error',error_msg); } I know it is primitive but it is working form me at the moment. |