I'm still trying to figure out how to change the font style for all
columns in the currently selected row in a Grid. I tried to make this
work by subclassing Grid and adding methods to highlight/unhighlight the
text in the row. My class looks like this:
<class name="myGrid" spacing="2" extends="grid" showvlines="true"
bgcolor1="#EEEEEE" bgcolor0="white">
<gridcolumn name="column1" text="Column 1" width="180" resizemargin="1"
resizable="false">
<text font="Arial" fontstyle="bold" datapath="column1/text()"/>
</gridcolumn>
<gridcolumn name="column2" text="Column 2" width="${parent.width -
360}" resizemargin="1" resizable="false">
<text font="Arial" fontstyle="bold" datapath="column1/text()"/>
</gridcolumn>
<gridcolumn name="column3" text="Column 3" width="180" resizemargin="1"
resizable="false">
<text font="Arial" fontstyle="bold" datapath="column1/text()"/>
</gridcolumn>
<method name="highlightSelectedRow">
var currentRow = getSelection();
Debug.write("Current row: " + currentRow);
currentRow.column1.text.fontstyle="bold";
currentRow.column2.text.fontstyle="bold";
currentRow.column3.text.fontstyle="bold";
</method>
<method name="unhighlightSelectedRow">
var currentRow = getSelection();
Debug.write("Current row: " + currentRow);
currentRow.column1.text.fontstyle="plain";
currentRow.column2.text.fontstyle="plain";
currentRow.column3.text.fontstyle="plain";
</method>
</class>
I create an instance of this grid in a view and it gets populated via
XML. I've added a method to handle the selection event and when this
event is triggered, I call the unhighlightSelectedRow method. This much
of the code works. When I select the item, the method gets called and I
see the debug message displaying some minimal information about the
current row (the result of doing a getSelection() call). What confuses me
is that the result of getSelection() is an instance of LzDatapointer. I'm
obviously hopelessly confused about how to get at the columns defined in
my grid. Can someone offer some information about how grids work and how
I might be able to access the individual text objects associated with each
column of the selected row?
Thanks!
--
James Howe
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user