I am trying to use JQGrid as in http://trirand.com/blog/jqgrid/jqgrid.html . But it's not displaying anything. Please help me to get this working.
<html>
<head>
<script type="text/javascript" src="jquery-3.1.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
jQuery("#s3list").jqGrid({
url:'search.php?q=1',
datatype: "json",
width: 700, colNames:[
'Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', width:65},
{name:'invdate',index:'invdate', width:90,
searchoptions:{
dataInit:function(el) {
$(el).datepicker({dateFormat:'yy-mm-dd'});
} }},
{name:'name',index:'name', width:100},
{name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right", stype:'select',
editoptions:{value:":All;0.00:0.00;12:12.00;20:20.00;40:40.00;60:60.00;120:120.00"}},
{name:'total',index:'total', width:80,align:"right"}
{name:'note',index:'note', width:150, sortable:false}
],
rowNum:10,
mtype: "POST",
rowList:[10,20,30],
pager: '#s3pager',
sortname: 'id',
viewrecords: true,
rownumbers: true,
sortorder: "desc",
gridview : true,
caption:"Toolbar Search Example"
});
jQuery("#s3list").jqGrid('navGrid','#s3pager',
{edit:false,add:false,del:false,search:false,refresh:false});
jQuery("#s3list").jqGrid('navButtonAdd',"#s3pager", {
caption:"Toggle",
title:"Toggle Search Toolbar",
buttonicon :'ui-icon-pin-s',
onClickButton:function(){
mygrid[0].toggleToolbar()
}
});
jQuery("#s3list").jqGrid('navButtonAdd',"#s3pager", {
caption:"Clear",
title:"Clear Search",
buttonicon :'ui-icon-refresh',
onClickButton:function(){
mygrid[0].clearToolbar()
}
});
jQuery("#s3list").jqGrid('filterToolbar');
});
</script>
</head>
<body>
<table id="s3list"></table>
<div id="s3pager"></div>
<div id="filter" style="margin-left:30%;display:none">Search Invoices</div>
</body>
</html>
You need to load the jqGrid javascript library before you can use those functions. Please download the scripts from http://www.trirand.com/blog/?page_id=6 and add them to your script. (Load the script right after you load jQuery)
or just add this:
<script type="text/javascript" src="https://cdn.jsdelivr.net/jqgrid/4.6.0/jquery.jqGrid.min.js"></script>
Hope that helped :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.