2017-05-10 2 views
0

データ入力フォームと編集可能なグリッドを持つヘッダー/ディテールアカウンティングアプリケーションに剣道グリッドを使用しています。フォームをグリッドにタブで移動すると、最初のセルは 'navigate'イベントのいくつかの回避策の「ハック」コードを除いて編集モードにはなりません(下記参照)。問題は、フォーム入力フィールドからグリッドの最初のセルをタブで移動して同じセルをクリックすると、グリッド編集モードが異なる動作をすることです。最初のセルに(タブではなく)クリックすると、セルが編集モードになりますが、フィールドの内容はクリアされます。剣道グリッドセルが入力フィールドからグリッドにタブ移動するときに編集モードに入っていない

グリッドの最初のセルにタブを移動したり、セルを編集するためにそのセルをクリックしたりすることができます。

ここで焦点を当てた最初のセルを持つグリッドのスクリーンショットですが、編集モード(回避策なし「ハック」コード)ではありません:

enter image description here

ここでは、グリッドコードだ:

let grid = $("#" + target).kendoGrid({ 
    dataSource: { 
     data: rows, 
     schema: { 
      model: { 
       fields: columnSetup.modelFields 
      } 
     } 
    }, 
    edit: function (e) { 
     // This does not fire when tabbing to the grid. It will fire if a cell is clicked. 
    }, 
    editable: { 
     mode: "incell", 
     createAt: 'bottom' 
    }, 
    navigatable: true, 
    navigate: function (e) { 

     // Attempted Workaround - This does put the first cell in edit mode, but only when tabbing 
     // to the grid. However, clicking in the first cell does put the cell in edit mode, but 
     // clears the field value. 
     if (e.sender['_rowVirtualIndex'] == 0 && e.element[0]['cellIndex'] == 0 && typeof (e.sender['_editContainer']) != 'object') { 
      this.editCell(e.element[0]) 
     } 
    }, 
    resizable: true, 
    reorderable: true, 
    scrollable: { virtual: true }, 
    selectable: "row", 
    columns: columnSetup.columns, 
    dataBound: keyboardEventHandler, 

}).data('kendoGrid'); 
+0

誰かがTelerikと同じ質問をしているようです(http://www.telerik.com/forums/batch-grid---tabbing-into-grid-from-outside-input-does -not-kick-first-selected-cell-into-edit-mode)(ただし、3年前)。おそらく、グリッドの上にある入力をグリッド自体に移動すると(ツールバーテンプレートを使用して)、いくつかの成功が得られるでしょうか? – Sandman

+0

グリッドにタブインしたときにフィールドにフォーカスが得られない理由についての質問に答えます。したがって、残りの問題は、navigateイベントでeditCellを使用するのが、タブでクリックするときとは異なる動作をする理由です。 – ASA2

答えて

0

タブをクリックしてグリッドに移動してすぐに編集モードに入るには、グリッドの 'navigate'イベントでkendoHelpers 'refreshAndKeepEditing'関数を使用してください:

navigate: function (e) { 
    if (e.sender['_rowVirtualIndex'] == 0 && e.element[0]['cellIndex'] == 0 && typeof (e.sender['_editContainer']) != 'object') { 

     this.editCell(e.element[0]); 
     kendoHelpers.grid.refreshAndKeepEditing(grid, true); 
    } 
}, 
関連する問題