我有在它的数据和多个列剑术格(说栏1,2,和3)。 列1,2,3需要能够进行编辑(或预防编辑)基于离彼此的值。 这是特定行。
例如,如果第1列(日期)是<柱2(日期)列,然后3是不允许进行编辑。
我知道这是很简单的禁用或启用的整个列,但我的要求是特定行。 所以,第1行可能有第3列启用和行2可能有3列禁用。
有什么想法吗?
我有在它的数据和多个列剑术格(说栏1,2,和3)。 列1,2,3需要能够进行编辑(或预防编辑)基于离彼此的值。 这是特定行。
例如,如果第1列(日期)是<柱2(日期)列,然后3是不允许进行编辑。
我知道这是很简单的禁用或启用的整个列,但我的要求是特定行。 所以,第1行可能有第3列启用和行2可能有3列禁用。
有什么想法吗?
我的建议是创建验证条件的编辑功能。 当然,这有一个缺点是一个特设的解决方案,但...它的作品!
让具有以下项(数据源的数据):
var entries = [
{ id:1, col1: new Date(2012, 11, 31), col2: new Date(2013, 0, 1), col3: "Yes" },
{ id:2, col1: new Date(2013, 0, 1), col2: new Date(2013, 0, 1), col3: "No" },
{ id:3, col1: new Date(2013, 0, 2), col2: new Date(2013, 0, 1), col3: "No" }
];
然后我定义网格为:
var grid = $("#grid").kendoGrid({
dataSource : {
data : entries,
schema : {
model: {
id : "id",
fields: {
col1: { type: "date"},
col2: { type: "date"},
col3: { editable: true }
}
}
},
pageSize: 3
},
columns : [
{ field: "col1", title: "Col1", format: "{0:yyyy-MM-dd}" },
{ field: "col2", title: "Col2", format: "{0:yyyy-MM-dd}" },
{ field: "col3", title: "Edit?", editor: checkAndEdit }
],
editable : "incell",
navigatable: true,
pageable : true
}).data("kendoGrid");
其中col1
和col2
的日期和col3
是可编辑的字符串, 当且仅当 col1
小于col2
。
我定义checkAndEdit
功能如下:
function checkAndEdit(container, options) {
if (options.model.col1 < options.model.col2) {
$('<input data-bind="value:' + options.field + '" ' +
'data-format="' + options.format + '" ' +
'class="k-input k-textbox"/>')
.appendTo(container);
} else {
grid.closeCell(container);
}
}
我在哪里生成相应的input
字段如果col1
< col2
和否则调用closeCell
用于退出edit
模式。
你可以看到它运行在这里
保持简单只需要使用(你在你的表格列绑定)
[Editable(false)]
public string ob_name { get; set; }
在你的服装类,它使用的是您剑道UI电网。
有关详情,您还可以看到这