单击时清除或 Select kendo 网格单元格
Clear or Select the kendo grid cell on click
我有一个 kendo 网格 - 有多个星期的小时列(我正在使用 clienttemplate 来显示它)
我还有一个编辑器模板来编辑这些列。我已将编辑模式设置为 Incell
现在我的要求是 select 单击单元格时的单元格。我试过了:
function edit(e) {
var input = e.container.find("input");
input.select();
}
和
var currentDataItem = e.sender.dataItem(this.select());
但是没用。请帮忙。
您可以这样做:
$("#grid").kendoGrid({
dataSource: {
type: "json",
pageSize: 10,
serverPaging: true,
transport: {
read: "http://whatever"
}
},
selectable: "cell",
pageable: true,
columns: ["ProductID", "ProductName"],
change: function() {
var dataItem = this.dataSource.view()[this.select().closest("tr").index()];
alert(dataItem.UnitPrice);
}
}
感谢您的帮助...
我使用了下面的代码并且它正在工作
var input = e.container.find("input");
input.focus(function () {
setTimeout(function () {
input.select();
});
});
我有一个 kendo 网格 - 有多个星期的小时列(我正在使用 clienttemplate 来显示它) 我还有一个编辑器模板来编辑这些列。我已将编辑模式设置为 Incell 现在我的要求是 select 单击单元格时的单元格。我试过了:
function edit(e) {
var input = e.container.find("input");
input.select();
}
和
var currentDataItem = e.sender.dataItem(this.select());
但是没用。请帮忙。
您可以这样做:
$("#grid").kendoGrid({
dataSource: {
type: "json",
pageSize: 10,
serverPaging: true,
transport: {
read: "http://whatever"
}
},
selectable: "cell",
pageable: true,
columns: ["ProductID", "ProductName"],
change: function() {
var dataItem = this.dataSource.view()[this.select().closest("tr").index()];
alert(dataItem.UnitPrice);
}
}
感谢您的帮助... 我使用了下面的代码并且它正在工作
var input = e.container.find("input");
input.focus(function () {
setTimeout(function () {
input.select();
});
});