I am trying to make a legend using a DataGrid . My problem is, I want the text in the Datagrid to be colored. I use the onStyleRow function as outlined here: (http://dojotoolkit.org/reference-guide/dojox/grid/DataGrid.html) and it works the first time after deploying. The text in the DataGrid comes up red, but if i refresh or open try it on a different browser, the DataGrid text does not come up red, just the standard black.
I was wondering, what I was doing wrong, Thanks,
Here is my code:
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();
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…