Forum


16:50

04/01/2012

EDIT: As it turns out, updating the plugin to the latest version fixed my beforeProcessing problem.
EDIT: if I revert to my original code, so that I return the object that jqGrid expects, and then successfully reload the grid, NOTHING ever runs inside beforeProcessing(){} – not a simple alert('hi'); and not a simple console.log('hi there'); – but I thought that beforeProcessing was supposed to run after a successful ajax call? It sure doesn't seem to work.
I'm initializing my grid like so:
$("#mainGrid").jqGrid({
url : g_MainGridUrl,
datatype : 'json',
height : 660,
autowidth : true,
colNames : g_ColNames,
colModel : g_ColModel,
pager : '#pager',
rowNum : 100,
rowList : [100, 200, 300],
sortname : g_DefaultSort,
sortorder : 'desc',
sortable: true,
viewrecords : true,
caption : 'Results',
hidegrid : false,
rownumbers : true,
jsonReader : {
root : "ROWS",
page : "PAGE",
total : "TOTAL",
records : "RECORDS",
cell : "",
id : g_DefaultSort
},
beforeProcessing: function(data, status, xhr){
console.log(data);
},
loadError: function(xhr, status, error){
alert(xhr.statusText);
},
loadComplete: function(data){
//console.log(data);
// more stuff happens here
}
});
and whenever I want to update the grid, I'm calling it like so:
$('#mainGrid').setGridParam({
url : g_MainGridUrl + Ext.util.JSON.encode(filter)
});
$('#mainGrid').trigger("reloadGrid");
My problem is this: I'm trying to implement a uniform error handler in Coldfusion, so that remote cfc calls that have errors don't just return status=200 responses and die without letting the user know that an error occurred. To that end, I'm trying Ben Nadel's model and returning a uniform struct that's formed like so:
RESPONSE.SUCCESS = "false"
RESPONSE.ERRORS = [array of errors]
RESPONSE.DATA = {normal data that jqgrid expects}
From reading your docs, I tried implementing
beforeProcessing: function(data){
console.log(data + 'hi'); // just to test whether it's working
}
in my initialization code, but nothing is output to the console, whether when first initialized or called again.
So I thought that I should be setting ajaxGridOptions{} instead, but I can't figure out how to make it work – I need to set a RESPONSE.SUCCESS handler that remaps RESPONSE.DATA to the data object expected by jqGrid, and I also need to set a RESPONSE.SUCCESS == 'false' handler as well. My experiments so far have not been fruitful.
Thanks for any help.
Most Users Ever Online: 715
Currently Online:
67 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66