Animal
11-10-2006, 07:36 AM
Would it be possible to add a function to the DefaultColumnModel which gives access to the style object for that column's ygrid-col-n style?
That way, you could delegate special formatting to the ColumnModel - which is what has the knowledge of what columns should look like.
Currently, the ColumnModel doesn't know anything about the Grid, so it doesn't know the id, so it can't do
var rule = YAHOO.ext.util.CSS.getRule(["#" + this.grid.id + " .ygrid-row", ".ygrid-row"]);
rule.textAlign = "center";
Which is what I want on certain columns.
The DataModel might want a say in this too. I know this might break MVC separation, but is there a way round that?
My current problem, is that some Grids need an extra column of checkboxes, so that multiple columns can be selected (They don't want normal selection by just highlighting the row, they want checkboxes!). So I tell my Grid object which tells its ColumnModel (which adds an extra column), and the DataModel, which inserts an extra Boolean data value. This column needs to be centred to look right.
That way, you could delegate special formatting to the ColumnModel - which is what has the knowledge of what columns should look like.
Currently, the ColumnModel doesn't know anything about the Grid, so it doesn't know the id, so it can't do
var rule = YAHOO.ext.util.CSS.getRule(["#" + this.grid.id + " .ygrid-row", ".ygrid-row"]);
rule.textAlign = "center";
Which is what I want on certain columns.
The DataModel might want a say in this too. I know this might break MVC separation, but is there a way round that?
My current problem, is that some Grids need an extra column of checkboxes, so that multiple columns can be selected (They don't want normal selection by just highlighting the row, they want checkboxes!). So I tell my Grid object which tells its ColumnModel (which adds an extra column), and the DataModel, which inserts an extra Boolean data value. This column needs to be centred to look right.