在內聯編輯中實現kendo網格時,可以爲每個單獨的字段指定自定義編輯器。例如,它可以在使用這種配置來完成:
columns: [
{ field:"ProductName",title:"Product Name" },
{ field: "Category", width: "150px", editor: categoryDropDownEditor },
{ field: "UnitPrice", title:"Unit Price", format: "{0:c}", width: "150px" },
{ command: "destroy", title: " ", width: "110px" }],
editable: true
其中用於categoryDropDownEditor的代碼如下所示:
function categoryDropDownEditor(container, options) {
$('<input data-text-field="CategoryName" data-value-field="CategoryName" data-bind="value:' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
autoBind: false,
dataSource: {
type: "odata",
transport: {
read: "http://demos.kendoui.com/service/Northwind.svc/Categories"
}
}
});
}
這裏會發生什麼事是,categoryDropDownEditor功能爲創建acutal標記編輯器,針對該特定領域。在你的情況下,唯一需要做的就是實現一個自動完成小部件,而不是一個下拉列表。這個例子是從劍道UI的demo page
我希望能回答你的問題!
感謝您花時間回覆我的問題並回答這個問題,非常感謝! –
我會在幾分鐘內標記爲答案...因爲它不允許我:)謝謝! –
沒問題,我很樂意幫助:)我實現了很多我的自我,當你掌握它時,你真的可以節省一些時間。 – Logard