After you publish the link http://ccclients.com/TEST/TEST.php I understand what error you make. You should not separate jqGrid definition in two calls:
jQuery("#list").jqGrid({
datatype: 'xml',
mtype: 'GET',
loadonce: true,
// other parameters
caption: 'My first grid',
xmlReader: {
root: "export",
row: "row",
repeatitems: false
}
});
and
$("#list").jqGrid({loadComplete:
function() {
alert('load complete')
}
});
but define loadComplete
as a part of one call of $("#list").jqGrid({ ... });
like following:
jQuery("#list").jqGrid({
datatype: 'xml',
mtype: 'GET',
loadonce: true,
// other parameters
caption: 'My first grid',
xmlReader: {
root: "export",
row: "row",
repeatitems: false
},
loadComplete: function(data) {
alert('load complete');
}
});
If you do have to set an event handler later you should use setGridParam
method (See http://stackoverflow.com/questions/3148320/add-an-event-handler-to-jqgrid-after-instantiation/3149534#3149534)
Moreover I strictly disagree with the answer of Groxx. The function loadComplete
will be called for all datatypes (inclusive 'xml', 'json', 'local' and so on). How you can see in the documentation under http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events#execution_order the function loadComplete
is the perfect place to make some modification in the grid after the data are loader (or refreshed). I use this function permanently. The usage of datatype a function is a last ways if you need to load very exotic data (neither xml nor json etc). For loading of xml and json data there are a lot of customization features in jqGrid (see http://stackoverflow.com/questions/2675625/setting-the-content-type-of-requests-performed-by-jquery-jqgrid/2678731#2678731 for example). So you can customize the jQurey.ajax
call and convert the data used as input and output of jQurey.ajax
practically like you want.