Reputation: 185
I want to set viewrecords property of jqgrid dynamically. By default this property is set as false. I want to set this to true or false (sometimes to show and at times not to show the recordText at the table footer) depending upon the data that I am populating in the grid dynamicaly. I tried with the following but with no avail-
jQuery("#gridID").jqGrid({viewrecords : true});
jQuery("#gridID").setGridParam({viewrecords : true});
Upvotes: 2
Views: 4442
Reputation: 221997
I recommend you to use viewrecords: true
and just hide the div.ui-paging-info
inside of loadComplete
depend from the current number of records. For example
loadComplete: function (data) {
if (parseInt(data.records, 10) > 10) {
$("#pager div.ui-paging-info").show();
} else {
$("#pager div.ui-paging-info").hide();
}
}
The demo demonstrate the approach. If you open on the demo the searching dialog and filter for the client data equal to test
you will see only one record and the viewrecords
field will be not visible:
Clicking on the "Reload Grid" navigator button will follow to show the viewrecords
field back.
Upvotes: 2