2009-11-30 6 views
6

iamはグリッドからの値に応じてDojoX(1.2.3)グリッド内で行のスタイルを設定しようとしています。データに依存するスタイルDojoxグリッド・ロー

のGridLayout:

var view1 = { 
       noscroll: true, 
       rows: [{ 
        field: 'TASK_ID', 
        name: 'ID', 
        width: '80px', 
        get: this.getColor 
       }, { 
        field: 'MENUPOINT', 
        name: 'Action', 
        width: '250px' 
       }] 
      }; 

GETCOLOR機能:

getColor: function(inRowIndex) { 
     console.log(inRowIndex); 
     grid = dijit.byId('gridTaskCurrent'); 
      // if task_id = 1 style row with other background(?) 
     }, 

と私はどのようにすべての行からTASK_ID値を取得し、誰かが持っている場合.. 行のスタイルを設定するには考えています良いリンクかどうかを知っている..それは素晴らしいだろう。

答えて

10

は私の自己でそれを手に入れた:

dojo.connect(dijit.byId('gridTaskCurrent'), 'onStyleRow' , this, function(row) { 
        var item = grid.getItem(row.index); 

        if (item) { 
         var type = grid.store.getValue(item, "LOCKED", null); 
         if (type == 1) { 
          row.customStyles += "background-color:limegreen;"; 
         } 
        } 

        grid.focus.styleRow(row); 
        grid.edit.styleRow(row); 


       }); 
関連する問題