2016-09-09 3 views
0

私のKENDOグリッドでグループ化可能なオプションを追加/削除するトグルボタンを作成します。初期化では、私は 'グループ化可能'プロパティを持っていません。角度付きの剣道グリッドでグループ化可能なオプションが動的に設定されない

{ 
     type: "button", 
     togglable: true, 
     id: "groupableToggle", 
     toggle: function (e) { 
      var grid = $("#grid" + config.id).data("kendoGrid"); 
      if (e.checked) { 
       grid.options.groupable = { 
        messages: { 
        empty: "drag a column header and drop it here to group by that column" 
        } 
       };      
      } 
      else 
       grid.options.groupable = false 

      grid._thead(); 
      grid.refresh(); 
     } 
    } 

これは機能しません。

OK!見つけた!今

   if (e.checked) { 
       grid.setOptions({ 
        groupable: true, 
        messages: { 
         empty: "drag a column header and drop it here to group by that column" 
        } 
       }); 
      } 
      else { 
       grid.setOptions({ 
        groupable: false 
       }); 
      } 


      grid._thead(); 
      grid.refresh(); 

とはgroupable設定がグリッドを再作成することなく、その場で変更することはできません

答えて

0

を果たしています。グリッドのsetOptionsメソッドを使用するか、またはk-rebindメソッドを使用してください。

http://docs.telerik.com/kendo-ui/AngularJS/introduction#widget-update-upon-option-changes

+0

http://docs.telerik.com/kendo-ui/api/javascript/ui/widget#methods-setOptions IF(e.checked){ grid.setOptions({ グループ化可能:真、 メッセージ:{ 空の「列ヘッダーをドラッグして、グループにそれをここにドロップその列 " } });} } grid._thead(); grid.refresh(); – GomuGomuNoRocket

+1

setOptions()の後に_thead()またはrefresh()を呼び出す必要はありません。 – dimodi

関連する問題