简体   繁体   English

如何在asp.net中计算Jqgrid列的摘要

[英]How To calculate summary of Jqgrid Column In asp.net

Hii Guys!! 嗨,大家好! I developed a jqgrid in which i need to calculate summary of 'duration' and 'price' columns on footer of the grid But i dont have idea how to do this as I am first time using the Jqgrid.. Below is My code .... 我开发了一个jqgrid,其中我需要在表格的页脚上计算“持续时间”和“价格”列的摘要,但是我不知道该如何做,因为我是第一次使用Jqgrid。 ..

 var categoriesStr = ":All;1:vikas;2:Ankur";
    $(function () {
        $("#UsersGrid").jqGrid({
            url: 'getGriddahico.ashx',
            datatype: 'json',
            height: 250,
            colNames: ['UserID', 'username', 'ordinal', 'authcode', 'extension', 'trunk', 'dialnumber', 'dialdate', 'dialtime', 'duration', 'destination', 'price', 'toc'],
            colModel: [
                    { name: 'UserID', index: 'UserID', width: 100, sortable: true, align: 'center',hidden:true },
                    { name: 'username', width: 100, sortable: true, align: 'center' },
                    { name: 'ordinal', width: 100, sortable: true, align: 'center' },
                    { name: 'authcode', width: 100, sortable: true },
                    { name: 'extension', width: 100, sortable: true, align: 'center' },
                    { name: 'trunk', width: 100, sortable: true, align: 'center' },
                    { name: 'dialnumber', width: 100, sortable: true, align: 'center' },
                    { name: 'dialdate', width: 100, sortable: true, align: 'center' },
                    { name: 'dialtime', width: 100, sortable: true, align: 'center' },
                    { name: 'duration', width: 100, sortable: true, align: 'center' },
                    { name: 'destination', width: 100, sortable: true, align: 'center' },
                    { name: 'price', width: 100, sortable: true, align: 'center' },
                    { name: 'toc', width: 150, sortable: true, align: 'center' }
                ],
            rowNum: 100,
            rowList: [100, 200, 300],
            pager: '#UsersGridPager',
            sortname: 'username',
            //loadonce: true,
            viewrecords: true,
            ignoreCase:true,
            sortorder: 'asc',
            autowidth: true,
            toppager: true,
            height: '100%'

        });

        $("#UsersGrid").jqGrid('navGrid', '#UsersGridPager', { edit: false, add: false, del: false, search: false });


        jQuery("#UsersGrid").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false });
    });

Any Help will be Heartily Welcomed .. Thanx in advance... 我们将竭诚欢迎任何帮助..谢谢。

You would calculate those values in your controller and then pass them in via userdata in your JSon. 您可以在控制器中计算这些值,然后通过JSon中的userdata传递它们。 Ex 防爆

records = totalRecords,
                userdata = new { price: Value1, toc: Value2 //etc },
                rows = (

Inside your jqGrid configuration you would also turn on 在jqGrid配置中,您还可以打开

        footerrow: true,
        userDataOnFooter: true,

Then with your above sample code Value1 would be displayed in the footer of the price column and Value2 would be displayed in the footer of the toc column. 然后,使用上面的示例代码,Value1将显示在price列的页脚中,而Value2将显示在toc列的页脚中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM