Datagridの選択した行をプログラムでスタイル設定することは可能ですか?
誰かがスニペットを与えることができますか?
Datagridの選択した行をプログラムでスタイル設定することは可能ですか?
誰かがスニペットを与えることができますか?
これを試してください(リファレンスガイドの例を変更したフィドルです):
var grid = new dojox.grid.DataGrid({
id: 'grid',
store: store,
structure: layout,
rowSelector: '20px',
onClick: function() {
// ( selection.selected is array for multiple)
var index = this.selection.selectedIndex,
// typically 1 here, mess with it if nogo on solution
viewindex = 1,
RAWROWNODE = this.views.views[viewindex].rowNodes[index]
}
}, document.createElement('div'));
グリッドコンポーネントで使用されるスタイルシートを調べることもできます。
.dojoxGridRow,
.dojoxGridRowOdd,
.dojoxGridRowSelected {
}
正しいcssクラスを単純にオーバーライドしてみませんか?それ以外の場合は、onStyleRowおよびstyleRowState関数を確認することをお勧めします
これを試して
dojo.connect(grid, 'onStyleRow', this, function (row) {
if (grid.selection.selectedIndex == row.index) {
row.customStyles += "color: red;";
}
grid.focus.styleRow(row);
grid.edit.styleRow(row);
});