Forum



I'm not convinced that the gridComplete event runs "after all the data is loaded into the grid and all other processes are complete," as specified in the documentation.
I've got a grid that is loading correctly. In the gidComplete event, I'm triggering some filtering methods (.extend and .setGridParam) to apply a filter as soon as the grid is loaded. However, although my custom function is firing (seen through console), the filter is not being applied. If I use the setTimeout to delay the execution by a second (or so), then the filter is, in fact, applied. So it seems to me that the gridComplete is firing too early.
Incidentally, the filter function (called setGridFilter()) also fires in an onchange event bound to a select menu (where the user can choose from pre-set filter options). This works perfectly. It's just the gridComplete invocation of this function that is failing.
Any ideas?
$("#list3").jqGrid({
url: 'blah.php',
colNames: ['blah1','blah2','etc.','PresentationTemplateID'],
colModel: [name: 'blah1', index: 'blah1'],
[name: 'blah2', index: 'blah2'],
[name: 'etc.', index: 'etc.'],
[name: 'PresentationTemplateID', index: 'PresentationTemplateID', hidden:true]
viewRecords:true,
loadonce: true,
pager: '#pager3',
search:true,
gridComplete: function(){
//var t = setTimeout('setGridFilter()',1000); //this works, for some reason
setGridFilter(); //this does not
}
});
function setGridFilter() {
var postdata = $("#list3").jqGrid('getGridParam','postData');
var text = $("#ddlGridFilterMenu").val(), f;
$.extend(postdata,{filters:'',searchField: 'PresentationTemplateID', searchOper: 'eq', searchString: text});
$("#list3").jqGrid('setGridParam', { search: text.length>0, postData: postdata });
$("#list3").trigger("reloadGrid",[{page:1}]);
}
Most Users Ever Online: 715
Currently Online:
52 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