如何在Kendo Grid中启用单个列的编辑

时间:2014-09-15 12:28:17

标签: kendo-ui

我想仅对以下代码的地址字段启用编辑:
$( “#电网”)。kendoGrid({             列: [{                 field:“name”,//创建一个绑定到“name”字段的列                 title:“Name”,//将其标题设置为“Name”
            },

        {
            field: "age",// create a column bound to the "age" field
            title: "Age" ,// set its title to "Age"           
        },
        {
            field: "doj",
            title: "DOJ",            
        },
        {
            field: "address",
            title: "ADDRESS",            
        },
        { command: [{ name: "destroy", text: "Remove" }, { name: "edit", text: "edit" }] }],
        editable: "popup",
        sortable:true,
        dataSource: [{ name: "Jane", age: 30, address: "Bangalore", }, { name: "John", age: 33, address: "Hyderabad" }]
    });

2 个答案:

答案 0 :(得分:1)

定义可编辑:false& nullable:对数据库模式列为true。

dataSource = new kendo.data.DataSource({
..
schema: {
           model: {
               id: "YourID",
               fields: {
               YourID: { editable: false, nullable: true },
               address: { editable: false, nullable: true },
               ..
               ..
                   }
                }
            }
..
})

答案 1 :(得分:0)

您必须为列设置editable:false。

model: {

    fields: {

        ProductID: {

            editable: false    
        }    
    }    
}