【问题标题】:How to enable editing for a single column in Kendo Grid如何在 Kendo Grid 中启用单个列的编辑
【发布时间】:2014-11-08 23:40:19
【问题描述】:

我只想为以下代码的地址字段启用编辑:
$("#grid").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" }]
    });

【问题讨论】:

    标签: kendo-ui


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

      您必须为列设置 editable: false。

      model: {
      
          fields: {
      
              ProductID: {
      
                  editable: false    
              }    
          }    
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-08-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多