How to display total of records in jqgrid -
i trying display total records in jqgrid. here code using display.grid displaying not getting total.
and getting error:footer-row invalid propert can tell me mistake?
$("#jqgrid").jqxgrid( { pagesize: 5, source: dataadapter, width: 700, sortable: true, pageable: true, autoheight: true, columnsresize: true, filterable: true, showfilterrow: true, showtoolbar: true, footerrow: true, userdataonfooter:true, rendertoolbar: function (toolbar) { var container = $("<div style='overflow: hidden; position: relative; margin: 3px;'></div>"); var exportbutton = $("<div style='float: right; margin-right: 5px;'> <img style='position: relative; margin-top: 2px; width: 16px; height: 16px;' src='images/excel.png' /><span style='margin-left: 4px; position: relative; top: -3px;'>export excel</span></div>"); container.append(exportbutton); toolbar.append(container); exportbutton.jqxbutton({ width: 150, height: 20 }); exportbutton.click(function (event) { $("#jqgrid").jqxgrid('exportdata', 'xls', 'report'); }); }, selectionmode: 'checkbox', //rendertoolbar: function (toolbar) { // var container = $("<div style='overflow: hidden; position:relative;margin:3px;'></div>"); // var exportbutton = $("<div style='float:right;margin-right:20px;'><img style='position:relative;margin-top:2px;width:16px;height:16px' src='./images/excel.png'/><span style='margin-left:4px;position:relative;top:2px'>export excel</span></div>"); // exportbutton.jqxbutton({ width: '130' }); // container.append(exportbutton); // toolbar.append(container); //} columns: [ { text: 'villagename', datafield: 'villagename', width: 'auto' }, { text: 'samples collected', datafield: 'villagesamples', width: 'auto' } ], gridcomplete: function () { calculatetotal(); }, }); var themesetting = { theme: "darkblue" }; $("#jqgrid").jqxgrid(themesetting); var calculatetotal = function () { var griddata = $("#jqgrid").jqgrid('getgridparam', 'data'), = 0, totalamount = 0, totaltax = 0; (; < griddata.length; i++) { var rowdata = griddata[i]; totalamount += number(rowdata.villagesamples); } $("#jqgrid").jqgrid('footerdata', 'set', { name: 'total', villagesamples: totalamount }); }
Comments
Post a Comment