Reputation: 1141
I have a table (generated with JSON POST datas) created with jqGrid. The navigation works very well. I set the option to display the search button.
When I click on the options displayed ... but no research is done ...
Do the research is done with Javascript in the array elements, or does it specify a URL to search in Ajax?
here is my code.
<div id="liste">
<div id="messagebox"></div>
<div id="filter"></div>
<table id="list" class="scroll" cellpadding="0" cellspacing="0"></table>
<div id="pager" class="scroll" style="text-align:center;"></div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$("#list").jqGrid({
url:'/admin/statistique/getjson/',
datatype: 'json',
mtype: 'POST',
colNames:['','Nom','Visites Totales', 'Visites Uniques','Contact'],
colModel:[
{name:'edition',index:'edition', sortable:false,editable: false,width:15, align:"center"},
{name:'etablissement_nomAMarrakech',index:'etablissement_nomAMarrakech', sortable:true, editable: false,width:150, align:"center"},
{name:'',index:'', sortable:false, editable: false,width:200, align:"center"},
{name:'',index:'', sortable:false, editable: false,width:200, align:"center"},
{name:'',index:'', sortable:false, editable: false,width:240, align:"center"}
],
pager: '#pager',
rowNum:10,
rowList:[10,25,50,100,300],
sortname: 'etablissement_nomAMarrakech',
viewrecords: true,
autowidth: true,
rownumbers: false,
gridview : true,
sortorder: "desc",
caption:"Aperçu des statistiques"
});
jQuery("#list").jqGrid('navGrid','#pager',{edit:false,add:false,del:false,search:false,refresh:false});
});
</script>
Here is a screen
As you can see, when I submit the form, JQGrid write "Loading..." but no line is check...
Sincerely,
Upvotes: 1
Views: 6768
Reputation: 221997
You use
name:'',index:''
in the definition of three columns of the grid. It is wrong. You can compare is with the code where you try to declare class with three properties with the name ''.
The name
property is mandatory. It must be unique, can't be equal to one from reserved names ('rn', 'cb' and 'subgrid') and should not contain any meta-characters used in jQuery selectors like '.', ' ' and so on (see here).
Moreover if you use datatype: 'json'
without loadonce: true
the server will be responsible for the data filtering. On search request the new request to the server will be send which has additional
parameters like &searchField=edition&searchString=Spa&searchOper=cn
. The server should return back to the jqGrid the filtered data.
Upvotes: 2