开发者

How to sum the Row data while selecting the Checkbox in the JQGrid

while selecting the checkbox in the jqgrid i need to sum开发者_运维技巧 the values of row data in jqgrid and i need to display those data in the footer of the jqgrid.Please help me out how to achieve that.

Thanks in Advance, Silambarasan,


You can use footerData method. See here and here for details and demo examples.


I got the answer ,i solved that issue.

The Answer is.

footerrow:true, userDataOnFooter:true, onSelectRow: function(rowId) { handleSelectedRow(rowId); },

function handleSelectedRow(id) {

        var jqgcell     = jQuery('#list1').getCell(id, 'headerId');
        var amount     = jQuery('#list1').getCell(id, 'amount');            
        var cbIsChecked = (jQuery("#jqg_list1_"+jqgcell).attr('checked'));
     if(cbIsChecked==true)
         {

            if(amount!=null)
                {
                    totalAmt = parseInt(totalAmt) + parseInt(amount);
                }
         }else
             {
             if(amount!=null)
                {
                    totalAmt = parseInt(totalAmt) - parseInt(amount);
                }
             }

            myGrid.jqGrid('footerData','set',{needbydate:'Total Amount:',amount:totalAmt});

        }

The above function is used to get the values of the selected row by clicking the checkbox you will get the value from that by calling the external function like "handleSelectedRow" you pass your row object from that you do your operation and finally update your answer by using the jqGrid function like "myGrid.jqGrid('footerData','set',{needbydate:'Total Amount:',amount:totalAmt}); " It will update in your footer.

How to sum the Row data while selecting the Checkbox in the JQGrid

How to sum the Row data while selecting the Checkbox in the JQGrid

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜