【发布时间】:2014-07-31 06:17:30
【问题描述】:
在 Kendo UI Grid(使用 Angularjs)中,我有以下网格:
<div kendo-grid k-data-source="Table" k-options="thingsOptions" style="height: 365px">
$scope.thingsOptions = {
sortable: "true",
scrollable: "true",
toolbar: [{ name: "create", text: "Aggiungi Prodotto" }],
columns: [
{ field: "Name", title: "Name", width: "50px" },
{ field: "Description", title: "Description", width: "50px" },
{ field: "Price", title: "Price", width: "50px" },
{ field: "Active", title: "Active", template: '<input type="checkbox" disabled="disabled" #= Active ? checked="checked":"" # class="chkbx" />', width: "20px" },
{ command: [{ name: "edit", text: "Modifica" }], title: "", width: "172px" }
],
editable: "inline"
};
如何在某些情况下将“价格”字段设为只读?我必须测试一个变量,如果它是真的,我希望 Price 字段只读,否则可写。
我已经尝试在“thingsOptions”功能中添加:
edit: function (e) {
if(myvar == true)
e.container.find("input[name=Price]").enable(false);
}
但是 id 不起作用(未定义的引用)。
【问题讨论】:
标签: javascript jquery angularjs kendo-ui kendo-grid