• kendoGrid的一些基础配置


    $("#grid").kendoGrid({
            dataSource:{
                transport: {
                    read:  {
                        url: crudServiceBaseUrl + "/Products",
                        dataType: "jsonp"
                    },
                    update: {
                        url: crudServiceBaseUrl + "/Products/Update",
                        dataType: "jsonp"
                    },
                    destroy: {
                        url: crudServiceBaseUrl + "/Products/Destroy",
                        dataType: "jsonp"
                    },
                    create: {
                        url: crudServiceBaseUrl + "/Products/Create",
                        dataType: "jsonp"
                    },
                    parameterMap: function(options, operation) {
                        if (operation !== "read" && options.models) {
                            return {models: kendo.stringify(options.models)};
                        }
                    }
                },
                schema:{
                    model:{
                        id:'id',
                        fields:{ }
                    }
                },
                pageSize:20,
                batch: true,
                serverPaging: true,
                serverFiltering: true,
                serverSorting: true
            },
            // 导出excel
            toolbar:['excel','create'],
            persistSelection:true,          //checkbox多选的时候,必须添加,否则获取不到选中的数据
            noRecords:true,                 //当表格中没有数据,显示的信息
            excel:{
                fileName:'input.xlsx',      
                filterable:true ,  //显示过滤
                allPages: true    //导出所有页的数据
            },
            editable: {
                createAt: "bottom"     //每次新增的时候,从底部新增  bottom/top
            },
            pageable: {
                pageSizes: true,
                buttonCount: 5,
                refresh: true          //刷新按钮
            },
            columns:[
                { 
                    field:'b',           //返回数据字段
                    title:'物料名称',      
                    locked:true,         //冻结列
                    filterable:{ 
                        cell:{ 
                            operator:'contains',                     //包含
                            suggestionOperator:'contains',           //显示查询出来的数据   
                            showOperators:false                      //去掉右侧过滤按钮
                        }
                    }, 
                    attributes: {
                        "class": "table-cell",                               //添加类名
                        style: "text-align: right; font-size: 14px"          //添加样式
                    },
                    template:'',                                            //模板
                    200
                },
                {   
                    title:'操作',
                    // 按钮,控制是否显示
                    command:[{ name: "destroy", visible: function(dataItem) { return !dataItem.isDisabled === true }}]
                },
    { title:
    '行号', template:'#= ++record #', 50, attributes: { style: "text-align: center;"} }, // checkbox框 { selectable:true, 50 }, ], dataBinding:function(){ // 显示行号,必须要有pageSize record = (this.dataSource.page() - 1) * this.dataSource.pageSize(); } })
  • 相关阅读:
    个人作业——软件评测
    2020软件工程实践 作业3
    2020软件工程实践 寒假作业2
    2020软件工程实践 寒假作业1
    计网大概
    大写金额转换实现
    软件工程实践总结&个人技术博客
    个人技术博客
    软件评测
    疫情统计实现
  • 原文地址:https://www.cnblogs.com/zsj-02-14/p/9253974.html
Copyright © 2020-2023  润新知