user3148583
user3148583

Reputation: 11

sum of column data in jqgrid mvc4

I'm fetching data to jqgrid from database and displaying. here the question is , I've to display the sum of numeric column data in footer . Please help me to solve this.

Thanks in advance.:)

Upvotes: 1

Views: 293

Answers (1)

Vinoth Krishnan
Vinoth Krishnan

Reputation: 2949

Use the following code in your grid definition,

footerrow : true,
userDataOnFooter : true,
gridComplete : function() {
    var totalcount = $("#grid").jqGrid('getCol', 'column_name',
        false, 'sum');
    $("#grid").jqGrid('footerData', 'set', {
        display_column_name : 'Total Records',
        column_name : totalcount
     });
 }

You need to use your column name at (column_name) and to display text nearest left column name (display_column_name). Hope this helps.

Upvotes: 1

Related Questions