EasyUI Forum
June 15, 2024, 07:38:10 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Server database processing no validation hook for edatagrid extension  (Read 13060 times)
frapa02
Newbie
*
Posts: 6


View Profile
« 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.
Logged
tclemmer
Newbie
*
Posts: 1


View Profile
« Reply #1 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.

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!