Hi, the renderstatusbar method isn’t work for me, please help !
(if I un-mark the 2 line in renderstatusbar, Uncaught TypeError: Cannot read property ‘totalrecords’ of undefined )
function loadrec(option,selectdate){
// prepare the data
var source =
{
url: ‘query.php?option=’+option+”&selectdate=”+selectdate,
dataType: ‘json’,
cache: false,
datafields: [
{ name: ‘uuid’ },
{…
],
root: ‘Rows’,
sort: function()
{
// update the grid and send a request to the server.
$(“#jqxgrid”).jqxGrid(‘updatebounddata’, ‘sort’);
},
beforeprocessing: function (data) {
source.totalrecords = data[0].TotalRows;
}
};
var dataAdapter = new $.jqx.dataAdapter(source);
var zeroRenderer = function (row, columnfield, value, defaulthtml, columnproperties) {
if (value == 0) {
return ‘ ‘;
};
};
//var span = $(“<span id=’spanRowCount’></span>”);
$(“#jqxgrid”).jqxGrid({
source: source,
theme: ‘classic’,
sortable: ‘true’,
//pageable: true,
width: ‘810’,
autoheight: ‘true’,
virtualmode: true,
altrows: true,
showstatusbar: true,
//pageable: true,
rendergridrows: function(obj)
{
return obj.data;
},
renderstatusbar: function (statusbar) {
//var rowCount = $(“#jqxgrid”).jqxGrid(‘getrows’).length;
//statusbar.append(‘<div style=”margin: 5px;”>Rows count: <span id=”rowsCountSpan”>’ + rowCount’ + ‘</span></div>’);
},
columns: [
{ text: ‘UID’, datafield: ‘uuid’, width: 50, cellsalign: ‘left’, cellsformat: ‘n5’ },
…
]
});
/*
$(“#jqxgrid”).on(“bindingcomplete”, function (event) {
var rowCount = $(“#jqxgrid”).jqxGrid(‘getrows’).length;
$(‘#rowsCountSpan’).text(rowCount);
});
*/
}