我目前正在使用剑道网格。我一直试图做的是,当我单击添加新行按钮时,将显示空行(k-grid-edit-row)。我想发出警报消息,并说在编辑操作期间单击其他行时首先完成编辑操作。但是关键是,我不希望在单击当前的内联编辑行时显示警报消息。
我现在所做的是,当我单击当前的内联编辑行时,还会收到一条警报消息。
$('.k-grid-content').on("mousedown", function (e) {
var grid = $('#Grid').closest(".k-grid");
var editRow = grid.find(".k-grid-edit-row");
if (editRow.length > 0) {
alert("Please complete the editing operation before editing another row");
e.preventDefault();
}
else return;
});
答案 0 :(得分:0)
您可以尝试检查已单击行的索引。当您添加一行时,该行将移至顶部,索引为0。
在您的if语句中,还要检查索引是否不等于0。
看起来像if grid.data("kendoGrid").select().index() != 0
。
我还没有测试过,但是我认为它应该可以工作。