我试图根据网格中的值在DojoX(1.2.3)网格中设置一个Row的样式.
网格布局:
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(?) },
解决方法
得到了我自己:
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); });