I checked the source code of the example case and find that:
jQuery('#grid').jqGrid('navGrid','#pager',{“edit”:false,”add”:false,”del”:false,”search”:true,”refresh”:true,”view”:false,”excel”:true},{“drag”:true,”resize”:true,”closeOnEscape”:true,”dataheight”:150,”mtype”:”POST”},{“drag”:true,”resize”:true,”closeOnEscape”:true,”dataheight”:150,”mtype”:”POST”},
{“mtype”:”POST”},
{“drag”:true,”closeAfterSearch”:true,”multipleSearch”:true},{“drag”:true,”resize”:true,”closeOnEscape”:true,”dataheight”:150});
jQuery('#grid').jqGrid('navButtonAdd','#pager',{caption:'',title:'Export to Excel',onClickButton : function(e){
try {
jQuery(“#grid”).jqGrid('excelExport',{url:'grid.php'});
} catch (e) {
window.location= 'grid.php?oper=excel';
}
}});