2017-06-29 70 views
0

我有劍道網格,我需要添加一個DropDownList要我格的代碼是:添加的DropDownList彈出一個網格的菜單(劍道)

$("#grid").kendoGrid({ 

     dataSource: dataSource, 
     pageable: true, 
     height: 550, 
     toolbar: ["create"], 
     columns: [ 
     { field:"ProductName", title: "Product Name" }, 

     { command: ["edit"], title: " ", width: "250px" }], 
         editable: "popup" 
        }); 
       }); 
+0

@swapnilnax爲產品名稱 – moris62

回答

0

嘗試是這樣的:

columns: [ 
    { 
     field: "ENCODE", 
     title: "Encoding", 
     width: "100px", 
     editor: encodingEditor 
    } 
] 

function encodingEditor(container, options) { 
    $('<input data-bind="value:' + options.field + '"/>') 
     .appendTo(container) 
     .kendoDropDownList({ 
      valuePrimitive: true, 
      autoBind: false, 
      dataTextField: "NAME", 
      dataValueField: "NAME", 
      dataSource: encodingDataSource 
     }); 
}; 

var encodingDataSource = new kendo.data.DataSource({ 
    data: { 
     "items": [ 
      { 
       "NAME": "DOS", 
      }, 
      { 
       "NAME": "UKG", 
      }, 
      { 
       "NAME": "WIN" 
      } 
     ] 
    }, 
    schema: { 
     data: "items", 
     model: { 
      fields: { 
       NAME: { type: "string" } 
      } 
     } 
    } 
}); 
+0

謝謝百萬工作! – moris62

+0

不客氣 –