set grid class
Is it possible to set a class to the grid? I have different grids, but I want to assign the same classnames to them without having to add every gridId to the css.
My grid's id: title
My className: myGrid
title.setClass("title","myGrid");
title.setGridClass("myGrid");
The code above does not work, does anyone have a solution for this?
RG
November 18,
But maybe what you really need to apply "a few" styles for each grid is subclassing and add some properties:
Simple subclass:
http://www.activewidgets.com/javascript.forum.11859.1/how-to-extend-core-functionallity.html
Subclass adding property:
var MyGrid = AW.UI.Grid.subclass();
MyGrid.create = function(){
var obj = this.prototype;
obj.defineControlProperty('cellscolor', 'red');
obj.setStyle("background", function(){return this.getControlCellscolor()});
obj.setHeaderText(["Col1", "Col2", "Col3"]);
obj.setColumnCount(3);
}
var obj = new MyGrid;
obj.setControlCellscolor('yellow');
obj.setCellText("text");
obj.setRowCount(10);
document.write(obj);
var obj2 = new MyGrid;
obj2.setControlCellscolor('green');
obj2.setCellText("text");
obj2.setRowCount(10);
document.write(obj2);
C++
November 18,
Thanks for your answers, but what I want is different. I have 4 grids in one page. In other pages I have only one grid which class will be set through #myGrid.
But the 4 grids in one page have different id's. What setClass does is:
Calling setClass(name, value) will assign the CSS class aw-name-value which can be referred in stylesheet via
.aw-name-value {
...
}
I want to assign a overall class (instead of #myGrid -> .myGrid) to the grids. Is that also possible?
RG
November 19,
i.e
obj.setClass('name'.'value');
obj.getRowsTemplate().setClass('name'.'value');
obj.getHeadersTemplate().setClass('name'.'value');
obj.getCellTemplate().setClass('name'.'value');
with:
.aw-name-value { css ...}
November 19,