DataGrid を使用して凡例を作成しようとしています。私の問題は、Datagrid のテキストに色を付けたいということです。ここで概説されているように onStyleRow 関数を使用します: (http://dojotoolkit.org/reference-guide/dojox/grid/DataGrid.html)。デプロイ後初めて機能します。DataGrid のテキストは赤く表示されますが、更新するか別のブラウザーで試してみると、DataGrid テキストは赤く表示されず、標準の黒だけになります。
私は何を間違っていたのか疑問に思っていました, ありがとう, これが私のコードです:
if(dijit.byId("plotlegend")){
dijit.byId("plotlegend").destroy();
}
var threadGrid = new dojox.grid.DataGrid({
id: 'plotlegend',
store: oStore,
structure: layout,
rowsPerPage: 5,
rowSelector: false,
autoWidth: true,
query: {},
plotsObject: this.plotsObject,
onStyleRow: function(row){
var legend = this;
var item = legend.getItem(row.index);
if (item){
var variableName = legend.store.getValue(item, "plot");
if (variableName){
var color = "color:red;";
row.customStyles += color;
}
}
legend.focus.styleRow(row);
legend.edit.styleRow(row);
}
},document.createElement('div'));
dojo.byId("plotlegendbc").appendChild(threadGrid.domNode);
threadGrid.startup();
threadGrid.update();