简体   繁体   中英

Kendo Grid editable option is not working

I have simple kendo grid code to enable edit option for selected columns. However, editable option is not working.

DEMO

The problem is you're setting the schema when you're creating the grid. You need to set the schema when you're creating the datasource instead.

var dataSource = new kendo.data.DataSource({
    data: [{"EmpId":"Dev001", "Name": "David"},{"EmpId":"Dev002", "Name": "Sam"}],
    schema:{
    model:{
        id:"EmpId",
        fields:{
            EmpId:{editable:false, type:"string"},
            Name:{editable:true, type:"string"}
        }
    }
  }
});
  
$("#empGrid").kendoGrid({
    dataSource:dataSource,
    columns:[
        {field:"EmpId"},
        {field:"Name"},
        {
            command:["edit"]
        }    
    ],
    editable:"inline"
})

Here is the updated dojo example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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