2016-11-09 3 views
0

私は剣道の子グリッドを持っています。それはいくつかの行があります。各行にはいくつかのセルがあります。私は最初の行以外のセルの値を変更する場合、私は対応する最初の行のセルの値を取得し、いくつかの検証を行う必要があります。グリッドのすなわち、イベントを保存し、必要なときgrid.editCell()メソッドを使用するためのハンドラを追加します剣道グリッドの他のセルをクリックするのを防ぐ

enter image description here

コード

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

に添付された画像を参照してください。

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

デモ:http://dojo.telerik.com/@Stephen/EDeFO

+0

セルの変更イベントでこの条件を記述する必要があります。このセルの値が変更されると、週と週末の列の値を静的に変更するので、より多くの時間を実行します。 – Gowthami

+0

e.valuesとif-statementに対するチェックを追加して、必要なときだけ処理します。 saveイベントはすべてのセルで発生するので、必要なセルに対して適切な処理を行い、気にしないセルでは何もしないロジックを追加する必要があります。 –

0

試す スクリプトレベル

function CloseEditable(e) {  
     this.closeCell();  

}

ビューレベル

イベント(イベント=> events.Edit( "CloseEditable")

あなたが特定のセルを閉じたい場合は、セル

のcellIndexを取得
+0

私は彼がクリックしたセルを編集したくないと思っています...彼は彼が残しているセルにエディタを残そうとしています。 –

関連する問題