hi i want to calculate the sum of column in my jqgrid "column montant" and display it under my grid like Total : * *** under Montant column here is my grid :
<sjg:grid id="gridtable"
caption="Quittance Payée"
dataType="json"
width="755"
href="%{remoteurl}"
pager="true"
gridModel="gridModel"
rowList="5,10,15,20"
rowNum="5"
rownumbers="true"
>
<sjg:gridColumn name="entreprise" index="entreprise" title="Entreprise"/>
<sjg:gridColumn name="nature" index="nature" title="Nature" sortable="false"/>
<sjg:gridColumn name="numero" index="numero" title="Numero" sortable="false"/>
<sjg:gridColumn name="montant" index="montant" title="Montant" sortable="false"/>
</sjg:grid>
any ideas :)
On the latest version of jqGrid, you can do this:
This is done via the magic of the getCol method.
Initialize a variable that would hold the sum:
var sum = jQuery("#gridtable").getCol('montant', false, sum);
And it's done. The sum variable now has the sum of the column 'montant'. For more information on the other parameters of the getCol method, go here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.