The mouseDown/getURL portion is just the change event of the 
datagrid.

<mx:DataGrid change="onRowSelected(event.target.selectedItem)" />

The onRowSelected(row) function could then just call getURL with 
some property of the row data, e.g. row.url.  Just be sure to verify 
the row parameter first, since you will also get the change event if 
the user de-selects the row by ctrl-clicking.

Doug

--- In flexcoders@yahoogroups.com, "jameskeepnews" <[EMAIL PROTECTED]> 
wrote:
>
> Hello. I am very new to Flex -- and we're running the 2.0 Beta 
now, 
> knowing that we'll have to migrate to it eventually -- and was 
never 
> an enterprise-class ActionScript developer in Flash anyway, so 
> forgive me if my two questions seem very simple to some of you. 
> Nevertheless, I haven't seen a satisfactory answer to either 
> question here, or anywhere else online.
> 
> First question -- how could I dynamically generate an array of 
> DataGridColumns? Suppose I have the following:
> 
> 
> <mx:DataGrid id="grid_01">
>    <mx:dataProvider>{ someProvider }</mx:dataProvider>
> 
> .....
> 
> </mx:DataGrid>
> 
> 
> and, in place of those "dots," I'd want to have the following 
> results returned from "someProvider":
> 
> 
> <mx:columns>
>    <mx:Array>
> 
>       <mx:DataGridColumn columnName="gridcol_01" headerText="First 
> Column" textAlign="middle" />
>       <mx:DataGridColumn columnName="gridcol_02" 
headerText="Second 
> Column" textAlign="middle" />
>       <mx:DataGridColumn columnName="gridcol_03" headerText="Third 
> Column" textAlign="middle" />
>       <mx:DataGridColumn etc. />
> 
>    </mx:Array>
> </mx:columns>
> 
> 
> Could someone provide me with sample code for how to build out the 
> data provider so that those results might be returned?
> 
> Lastly, coming from a mouseDown/getURL sensibility in Flash, I'm a 
> little mystified by the way in which DataGrid cells -- or rows, in 
> my case -- can simply serve as links. In my case, I'd want a 
rolled-
> over row to call a different viewstack when clicked. Obviously, if 
> I'm generating the DataGrid dynamically, I won't have an automatic 
> reference to anything in my Datagrid within MXML. Also, I believe 
I 
> need to generate a cellRenderer to accomplish 
> a "stack.selectedChild=nameofstack" result for what is (to me) a 
> souped-up link. I've seen cellRenderer do impressive dynamic 
tricks, 
> EXCEPT linking to something! And, to reiterate, I'm looking to 
have 
> an entire row be a hyperlink, much as the DataGrid allows for a 
> rollover state for rows and would, from our users' perspective, be 
> seen as results of a search, arranged into a handy grid -- and 
rows 
> that should link to something else when clicked.
> 
> Any help that could be provided would be very much appreciated. 
> Thank you for your attention.
> 
> James
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to