您的位置:首页 > 其它

在kendogrid中控制数据格式以及实现求和

2016-04-29 09:51 507 查看
footertemplate:"#=kendo.toString(sum,'N2')#" 将合并值保留两位小数点

$("#mainGrid1").kendoGrid({

                dataSource: {

                    type: "json",

                    transport: {

                        read: {

                            url: "@Html.Raw(Url.Action("", ""))",

                            type: "POST",

                            dataType: "json",

                            data: additionalData

                        }

                    },

                    schema: {

                        data: "Data",

                        total: "Total",

                        errors: "Errors"

                    },

                    error: function(e) {

                        display_kendoui_grid_error(e);

                        // Cancel the changes

                        this.cancelChanges();

                    },

                    pageSize: @(defaultGridPageSize),

                    serverPaging: true,

                    serverFiltering: true,

                    serverSorting: true,

                    aggregate:[

                   {

                       field: "fQty", aggregate: "sum"

                   }

                    ]

                },

                pageable: {

                    refresh: true,

                    pageSizes: [@(gridPageSizes)]

                },

                scrollable: false,

                //dataBound: onDataBound,

                columns: [

                

                {

                    field: "fQty",

                    title: "架位数量",

                    width:90,

                    type:"Decimal",format:"{0:N2}",

                    attributes: { style: "text-align: right"},

                    headerAttributes:{ style: "text-align: center"},

                    footerAttributes:{ style: "text-align: right"},

                    aggregates: ["sum"],

                    footerTemplate: "#=kendo.toString(sum,'N2')#",

                    groupFooterTemplate: "Sum: #=sum#"

                }

                ]

            } );
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: