3.2.0

Setting Column Styles with obj.setXXX

Hi,

I like the AW Grid component and I'm having to generate html "on the fly" at the server (Its not very pretty, hence your wonderful grids!!)
and I'd like to set up column widths, alignment and border styles based on the data fields that I have.

With this in mind I have figured out how use an "in-line" syle sheet as follows;
<style type="text/css">
#myGrid .aw-column-0 {width: 50px; border-right: text-align: right}
#myGrid .aw-column-1 {width: 150px; text-align: right}
#myGrid .aw-column-2 {text-align: left}
#myGrid .aw-column-3 {text-align: right}
#myGrid .aw-column-4 {text-align: left}
</style>

However, I can't quite understand how to do this with the obj API. I have three questions;
1. How do I set the column width for column n to 50 pixels?
(If I use obj.setColumnWidth(50), where is the column number?)
2. What is the method to call for setting the aligment for column n?
3. Can I set the grid to automatically resize so that all columns are sized to the maximum text contained within?

Kind Regards

Jon





Jonathan Lees
November 21,
Jonathan,

Access the column using getCellTemplate(columno):

obj.getCellTemplate(1).setStyle("color", "green");
obj.getCellTemplate(1).setStyle("text-align", "center");

etc.
Joel
November 22,

This topic is archived.

See also:


Back to support forum