This is a migrated thread and some comments may be shown as answers.

[Solved] DropDown in Kendo Grid

1 Answer 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
crazy05
Top achievements
Rank 1
crazy05 asked on 03 Mar 2015, 04:11 PM
Hello,

Here is my Kendo Grid Code. My first issue is if Click on edit, name field which I make editable: false not working. It is giving textbox. 

My second issue is, I want to give dropdown for age. How can I do this ?

 $("#grid").kendoGrid({
        columns: [
           { field: "id", hidden: true },
          { field: "name", title: "Name" },
          { field: "age", title: "Age" },
            { command: ["edit"] }
        ],
        editable: "inline",
        dataSource: [
           { id: "1", name: "Coal", age: "30" },
           { id: "2", name: "Gas", age: "29" },
           { id: "3", name: "Hydro", age: "35" }
        ],
        schema: {
            model: {
                id: "id",
                fields: {
                    id: { editable: false },
                    name: { editable: false },
                    age: { editable: true }
                }
            }
        },
    });

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 05 Mar 2015, 09:38 AM
Hello crazy05,

The first issue is caused by a wrong configuration - the schema object should be part of the DataSource. For example:  
$("#grid").kendoGrid({
       columns: [
          { field: "id", hidden: true },
         { field: "name", title: "Name" },
         { field: "age", title: "Age" },
           { command: ["edit"] }
       ],
       editable: "inline",
       dataSource: {
           data: [
              { id: "1", name: "Coal", age: "30" },
              { id: "2", name: "Gas", age: "29" },
              { id: "3", name: "Hydro", age: "35" }
           ],
           schema: {
               model: {
                   id: "id",
                   fields: {
                       id: { editable: false },
                       name: { editable: false },
                       age: { editable: true }
                   }
               }
           }
       }
   });

Adding a DropDownList is usually done by populating the columns.values array, as shown in this demo.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
crazy05
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or