I have 2 header rows in my grid.The problem is, that because of this, there is another row in my Grid, unter my row with data. Here's my grid after rendering:
grid = new dojox.grid.DataGrid({ id : OwnId, store : gridStore, onStyleRow : function (row) {
if (row.index === 14) {
var color = "color:red;";
row.customStyles += color;
}
},
structure : structure,
onHeaderCellClick: function(e) {
if (!dojo.hasClass(e.cell.id, "staticHeader")) {
e.grid.setSortIndex(e.cell.index);
e.grid.onHeaderClick(e);
}
},
onHeaderCellMouseOver: function(e) {
if (!dojo.hasClass(e.cell.id, "staticHeader")) {
dojo.addClass(e.cellNode, this.cellOverClass);
}
}
});
So how can I eliminate/hide this empty rows ? Any Suggestions?
I'm creating structure like this:
var _gridStyle = 'text-align: center;';
var _dateColumn = true;
var _gridStructure = [];
console.log(params);
if (params.connectorNames !== "undefined") {
// setting grid structure
_gridStructure.push([]);
for (var i = 0; i < params.connectorNames.length; i++) {
_gridStructure[0].push({
name : "test",
headerClasses : "staticHeader"
});
}
_gridStructure.push([]);
for (var i = 0; i < metricNames.length; i++) {
// if data column is required
if (_dateColumn === true && i === 0) {
_gridStructure[1].push({
field : "Datum",
name : "Datum",
width : "5%",
styles : _gridStyle
});
_dateColumn = false;
i--;
} else {
_gridStructure[1].push({
field : metricNames[i],
name : metricNames[i].replace("ANZAHL_", ""),
styles : _gridStyle,
});
}
}
}
okay I added
onStyleRow: function(e) {
dojo.style(e.node.children[0].children[0].rows[0],'display','none');
}
to my grid... and the empty cells are gone. Change index of rows[0] to "1" if the first datacolumn is filled with data.