Skip to content

Adding Totals on Local Array

Since local array loads so fast that we need to add a timeout for the total formula to wait for DOM to finish loading.

Add the following first

Then use a separate javascript block in a timeout. 

    var colSum = $('#data1').jqGrid('getCol', 'quantity', false, 'sum'); // other options are: avg, count
    $('#data1').jqGrid('footerData', 'set', { 'name': 'Total', 'quantity': colSum });
}, 300);
You may need to change the column name and grid name accordingly.

Feedback and Knowledge Base