簡體   English   中英

Kendo Grid 在單元格編輯期間禁用另一列

[英]Kendo Grid disable another column during cell editing

我有 2 個單選按鈕,如果選中單選“按 % ”,則只能編輯百分比字段,而金額字段將禁止編輯。 與單選“金額”相同,如果選中,則百分比字段將無法編輯,並且只能編輯金額字段。

因為我在我的兩列中都使用了 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();
}

這是 DOJO 中的工作演示 提前致謝

這有效,我測試過

 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');
          }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM