我有一個kendo網格生成在jquery中,我想允許用戶編輯它的特定單元格。問題是,我知道有個編輯的整條生產線,像這樣的方法:Kendo Grid jQuery - 可編輯單元格
$("#gridItens").kendoGrid({
editable: true,
columns: [
...
]
});
它工作正常,但正如我之前說的,它允許用戶編輯整條生產線,而不是特定的細胞。我嘗試了類似上面的代碼,但它不起作用。
$("#gridItens").kendoGrid({
columns: [
{ field: "Number", title: "Number", width: "10%", editable: true }
]
});
有沒有什麼辦法讓單元格可編輯?
感謝)
UPDATE
我發現了一個解決方案。解決方案與我所做的不同之處在於每個列的配置必須位於模式部分,而不是列部分。
$("#gridItens").kendoGrid({
dataSource: {
type: "json",
transport: {
read:
{
url: "/RC/BuscarItensContrato",
data: { contratoId: 0 },
contentType: "application/json; charset=utf-8",
dataType: "json"
}
},
schema: {
model: {
fields: {
Id: { type: "number" },
Descricao: { type: "string", editable: false },
Numero: { type: "number", editable: true }
}
}
}
},
columns: [
{
field: "Selecionado",
title: "",
sortable: false,
width: 30,
headerTemplate: "<input type='checkbox' id='chkSelectAll' />",
template: "<input type='checkbox' name='gridcheckbox' id='#=Id#' />"
},
{ field: "Descricao", title: "Descrição", width: "30%" },
{ field: "Numero", title: "Número", width: "10%" }
]
});
要編輯單元格,試試這個功能:執行console.log(cell.find( 「輸入」)); – Juniar 2014-09-30 19:50:24
作品很好,謝謝!我必須添加'editable:true'到kendoGrid配置才能使其工作 – 2016-03-01 06:13:06