I would like to get an alert when errors occur when loading my jqGrid table. For instance, when the jsonReader is not well configured, like when repeatitems is true instead of false, U can see in Firebug the error:
ccur is undefined
[Break On This Error] idr = ccur[idn] || idr;
How can I place such an error in an alert? I have already tried using loadError
, but it doesn't work, because it is not even triggered.
It seems for me that you should just use
try - catch
block over jqGrid code:UPDATED: You are right, the
try {...} catch (err) {...}
which I described before work in IE only with reading local data. In case of getting data from the server the exception take place inside ofsuccess
callback of$.ajax
. To be exactly it take place inside ofaddJSONData
oraddXmlData
depend of the type of data which you use. To catch the exception you should modify code of jqGrid in the place. The modified code can be about the followingI tested in the demo the corresponding modified version of jquery.jqGrid.src.js which display error message. I don't reproduced exactly the error which you described so the error message is a little other as in your case.
If you need minimized version of the modified jquery.jqGrid.src.js file you can produce it yourself with any JavaScript minimizer. For example Microsoft Ajax Minifier can be free downloaded and installed. The usage as
will produce the new minimized version of jquery.jqGrid.src.js which will be even a little smaller as the original jquery.jqGrid.min.js.
Another good minimizer is available online here. You should use "Simple" Optimization only.