Search code examples
jqgrid

How to display calculated field in footer in jqgrid


i have a calculated field Total which is a sum of amount + tax columns.

i am trying to display calculated field's value in footer in jqgrid, it is not coming properly, currently i am getting Nan in the footer. and also when either amount or tax column has a blank cell i am getting NaN. this is what i have tried, demo link http://jsfiddle.net/vwdxs9vb/2/

please help.


Solution

  • It seems to me, that the main problem is that your origin data contains items with tax:"". parseInt("", 10) is NaN. You should use, for example,

    tax = parseInt(rowObject.tax || 0, 10);
    

    instead. See http://jsfiddle.net/OlegKi/vwdxs9vb/4/