我有剑道儿童网格。它有一些排。每行都有一些细胞。如果我改变第一行以外的单元格的值,我必须获得相应的第一行单元格值并进行一些验证。见附图
代码
var $container = $(container),
tdIndex = $container.index(),
$correspondingCell = $container.closest("tbody").find("tr:first td:eq(" + tdIndex + ")");
$('<input maxlength="9" data-bind="value:' + options.field + '"/>')
.appendTo($container)
.kendoNumericTextBox({
format: "0.####",
decimals: 0,
min: 0,
spinners: false,
change: function (e) {
//debugger;
CalculateFormatWeeks(options.model);
var uid = options.model.uid;
var cellinx = $('#kenTitleFormatsGrid .k-edit-cell')[0].cellIndex;
var row = $("#kenTitleFormatsGrid tbody").find("[data-uid='" + uid + "']");
var cell = row.children().eq(cellinx);
cell.css("font-style", "normal");
console.log("From Cell", $correspondingCell.text());
if (Number($correspondingCell.text()) == 0) {
alert("There is no daily GBO exists to enter the format gross. Please add the daily GBO data before proceeding");
}
}
}).off("keydown");
答案 0 :(得分:0)
为Grid的save事件添加一个处理程序,并在需要时使用grid.editCell()方法,即:
save: function (e) {
var $container = $(e.container),
tdIndex = $container.index(),
$correspondingCell = $container.closest("tbody").find("tr:first td:eq(" + tdIndex + ")");
if (Number($correspondingCell.text()) == 0) {
alert("There is no daily GBO exists to enter the format gross. Please add the daily GBO data before proceeding");
e.sender.editCell($container);
}
}
答案 1 :(得分:0)
function CloseEditable(e) {
this.closeCell();
}
查看级别
事件(events =&gt; events.Edit(“CloseEditable”)
如果你想要关闭特定的单元格,那么得到单元格的cellIndex