EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: mapner on September 17, 2012, 06:40:56 AM



Title: Grid OnLoadError
Post by: mapner on September 17, 2012, 06:40:56 AM
Hello:

in Grid - OnLoadError how to make for receive an error message from the server?

thanks


Title: Re: Grid OnLoadError
Post by: stworthy on September 18, 2012, 02:47:43 AM
What error messages do you want to receive? This event is triggered if the ajax request fails.


Title: Re: Grid OnLoadError
Post by: mapner on September 18, 2012, 05:11:07 AM
Ok, when I try to load a Datagrid and a database error happen in PHP, how to send and receive the database error message for show it in UI?



Title: Re: Grid OnLoadError
Post by: mzeddd on September 18, 2012, 06:09:25 AM
Do you mean you want to get some text like "We are sorry, but .... :(" sent by PHP script to your DataGrid?

Or would you like to have static message like "Failed to load data" from DataGrid and do not know how to trigger it by PHP?


Title: Re: Grid OnLoadError
Post by: stworthy on September 18, 2012, 06:12:36 AM
In fact, this is not ajax errors. The 'onLoadError' event is no suitable to do this. Try adding addtionable message in your success returning data.
{"total":0,"rows":[...],"err":"..."}

The data above will be sent to browser, you can use 'onLoadSuccess' event or 'loadFilter' function to get this data and retrieve the error message.


Title: Re: Grid OnLoadError
Post by: mapner on September 18, 2012, 10:18:07 AM
Ok Stworthy,  thanks!