From 3.6 we introduce new API, which is similar to jQuery UI. Using the new API saves a namespace
conflicts with other plugins and make using jqGrid more natural in the code, showing that this is connected
with jqGrid methods.
The calling convension is
(jqgridelement).jqGrid( method ,parameter1,...,parameterN);
Where method is exiting jqGrid method
In the example above we do:
jQuery("#newapi").jqGrid('navGrid','#pnewapi',{edit:false,add:false,del:false});
To enjoy full of this API a new variable is used in $.jgrid namespace - called $.jgrid.no_legacy_api,
which default value is false. The variable should be set before including jqGrid Java Script file or
can be added in the language file.
HTML
Java Scrpt code
jQuery("#newapi").jqGrid({
url:'server.php?q=2',
datatype: "json",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90},
{name:'name',index:'name asc, invdate', width:100},
{name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false}
],
rowNum:10,
rowList:[10,20,30],
pager: '#pnewapi',
sortname: 'invdate',
viewrecords: true,
sortorder: "desc",
caption:"New API Example"
});
jQuery("#newapi").jqGrid('navGrid','#pnewapi',{edit:false,add:false,del:false});