I want to add a column which will contain summation of some columns.
Basically I want to convert following:
to the following:
But this has to be done dynamically i.e. I shall provide colModel id of th e columns I want the summation of.
P.S. Using 4.13.5 version of free-jqgrid.
The most easy way to implement your requirements would be the usage of
jsonmap
andsorttype
defined as function, which returns the calculated value of the column. Additionally you would need to implementafterSetRow
callback, which fixes the value after modification the row (aftersetRowData
).The corresponding implementation could be like in the demo. The demo defines the grid with
total
column, which displays the sum ofamount
andtax
columns. The code of the demo looks as following: