After some more work, I've figured out how to update the text styles of my grid columns. Basically I do the following:

1. Define a method to handle the onselect event
2. When onselect is triggered, the item received as a parameter is a basegridrow. If you ask the item for its subviews you will get the text views for each of the grid columns.
3. For each subview, set the fontstyle to what I want.

It seems odd to me that somehow the gridcolumn objects just disappear, but perhaps these objects are just used to assist in the setting up the titles and the things that get replicated are the text objects? Anyway it seems to work and that's enough for me at this point.

On Tue, 10 Jan 2006 12:14:18 -0500, James Howe <[EMAIL PROTECTED]> wrote:

Someone just pointed out that my datapaths for my grid columns all refer to the same thing. This was just a copy/paste error when I edited the code for publication to the e-mail list. Each column does point to a separate element in the XML.

I also discovered that if I use the item which is available from the select event I can talk to a basegridrow instance. However, it's not clear to me how or whether I can get to the gridcolumns associated with that row. I've looked at the methods that basegridrow implements (by looking at the source code since this class seems to be undocumented) and I didn't find any obvious way to get at the grid columns. Since these items are replicated I'm wondering if I somehow have to talk to the replication manager to get at this information. Seems like an overly difficult way to get at something conceptually so simple.

Again, any and all help will be appreciated.

Thanks.


On Tue, 10 Jan 2006 11:03:36 -0500, James Howe <[EMAIL PROTECTED]> wrote:

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

Reply via email to