繁体   English   中英

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

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

嗨,大家好! 我开发了一个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 });
    });

我们将竭诚欢迎任何帮助..谢谢。

您可以在控制器中计算这些值,然后通过JSon中的userdata传递它们。 防爆

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

在jqGrid配置中,您还可以打开

        footerrow: true,
        userDataOnFooter: true,

然后,使用上面的示例代码,Value1将显示在price列的页脚中,而Value2将显示在toc列的页脚中。

暂无
暂无

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

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