【问题标题】:Kendo Grid disable another column during cell editingKendo Grid 在单元格编辑期间禁用另一列
【发布时间】:2021-07-30 03:04:36
【问题描述】:

我有 2 个单选按钮,如果选中单选“按 %”,则只能编辑百分比字段,而金额字段将无法编辑。与单选“Amount”相同,如果选中,则百分比字段将无法编辑,并且只能编辑金额字段。

因为我在我的两列中都使用了 column.editor。我尝试应用这种方法,但都不起作用。或者也许我在某个地方弄错了。

// method 1
e.container.find("input[name='amount']").each(function () { $(this).attr("disabled", "disabled") });
// method 2
$("input[name=amount]").prop("disabled", true).addClass("k-state-disabled");
// method 3
e.container.find("input[name='amount']").attr('disabled',true);
// method 4
if(e.container.find("[name]").first().attr("name") == "amount"){
  e.sender.closeCell();
}

Here are the working demo in DOJO。提前致谢

【问题讨论】:

  • 你给的链接有效吗?

标签: javascript jquery kendo-ui kendo-grid


【解决方案1】:

这个可行,我测试过

 edit: function(e) {
          var radio_checked_value = $("input[name='radio_check']:checked").val();                       
          if(radio_checked_value == 'percentage'){
            var columnIndex = this.cellIndex(e.container);
            var fieldName = this.thead.find("th").eq(columnIndex).data("field");
            if(fieldName  === "amount"){
              this.closeCell();
            }
          }else{
            console.log('disable percentage field');
          }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-08-09
    • 1970-01-01
    • 2020-02-10
    • 2019-05-14
    • 1970-01-01
    • 1970-01-01
    • 2019-08-09
    • 2020-02-19
    相关资源
    最近更新 更多