2016-11-21 21 views
0

私が最初に私の要件は、いくつかの関数呼び出しに、私は剣道グリッド内の「名前」列のテンプレートを変更したいということです編集テンプレートを動的

$("#dataGrid").kendoGrid({ 
        height: 450, 
        sortable: true, 
        columns:[  
          {field: "Status", title: " ", width:35}, 
          {field: "Year", title:" ", width:50}, 
          {field: "Name", title:" ", width:50} 
          ], 
        dataSource: surveydataSource 
       }); 

としてレンダリングされた剣道グリッドを持っています次のようになります。

$("#dataGrid").kendoGrid({ 
        height: 450, 
        sortable: true, 
        columns:[  
          {field: "Status", title: " ", width:35}, 
          {field: "Year", title:" ", width:50}, 
          {field: "Name", title:" ", width:50, template: "<strong>#: name # </strong>"} 
          ], 
        dataSource: surveydataSource 
       }); 

グリッド全体を再構築するより簡単な方法はありますか?剣道の列のテンプレートを変更/リセットすることはできますか?

答えて

0

これを設定するには、剣道グリッド.setOptions()を使用してください。

var grid = $("#dataGrid").data("kendoGrid"); 
    grid.setOptions({ 
     columns: [  
      {field: "Status", title: " ", width:35}, 
      {field: "Year", title:" ", width:50}, 
      {field: "Name", title:" ", width:50, template: "<strong>#: name # </strong>"} 
     ] 
    }); 
+0

実際にはこれは単なるサンプルであり、実際は私の列は非常に多く、その多くにテンプレートがあります。特定の列のみを選択して変更を適用する方法はありますか? – user2091061

+1

'.setOptions()'は各プロパティ(この場合は** columns **)をオーバーライドし、設定全体を適用し、グリッドを内部的に再作成するためです。 –

関連する問題