Sunday, 15 September 2013

javascript - How To Calculate Sum of jqgrid columns on footer row Locally -



javascript - How To Calculate Sum of jqgrid columns on footer row Locally -

after displaying database jqgrid need add together summary footer row needs calculate sum of particular column.i populating jqgrid locally..also have added jqgrid filter filters info .according need want summary footer changed on filtering info jqgrid filter toolbar...

here code:

$(function () { var griddata = null; var nn = null; $.ajax({ url: 'default.aspx/mymethod', datatype: 'json', contenttype: "application/json; charset=utf-8", type: 'post', success: function (reportdatanew, textstatus, xmlhttprequest) { griddata = json.parse(reportdatanew.d); console.log(griddata); $("#gridid").jqgrid({ data: griddata, datatype: "local", height: '100%', autowidth: true, ignorecase: true, rownum: 100, rowlist: [100, 200, 300], colnames: ['username', 'ordinal', 'extension', 'trunk', 'dialnumber', 'dialdate', 'dialtime', 'duration', 'destination', 'price'], colmodel: [ { name: 'username', index: 'username', width: 100, sortable: true, align: 'center' }, { name: 'ordinal', index: 'ordinal', width: 100, sortable: true, align: 'center' }, { name: 'price', index: 'price', width: 100, sortable: true, align: 'center'} ]

i need calculate sum of price column

in definition of local info include segment containing userdata info displayed in footer. before pass info grid calculate values passed within these variables.

ex of userdata:

userdata = new { colonename = "totals:", coltwoname = totalsvariablefromlocalcalculation}

then in grid turn on footers via

footerrow: true, userdataonfooter: true,

javascript jquery asp.net ajax jqgrid

No comments:

Post a Comment