RE: [flexcoders] Re: Can anyone help on getting data from a grid cell .. I know the row/column index

2007-02-27 Thread Robert Chyko
yourDataGrid.addEventListener(ListEvent.ITEM_CLICK, setColumnCopy);

function setColumnCopy(){

_selectedCol = yourDataGrid.columns[event.columnIndex].dataField;

Alert.show(yourDataGrid.selectedItem[_selectedCol]);

}

-Original Message-
From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of helihobby
Sent: Monday, February 26, 2007 11:25 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Can anyone help on getting data from a
grid cell .. I know the row/column index



Thank you all for the answers ...
The problem is that I need to know which cell he clicked on.

Or in other words, what is the text that displayed on that
cell...

Getting the complete ArrayCollection object which the user
clicked on 
is easy as I can ( as u guys mentioned ) simply grab the event
and do 
event.selectedItem.SOME_PROP_HERE

However, I need to know which prop he clicked on as during
runtime I 
do not know the name of SOME_PROP_HERE.

In my case I have over 40 columns per row and each carries the
name 
of Open1 Open2 Open3 Open4 . etc ...

So of course doing event.selectedItem.Open1 will work.

But how do I know if clicked on the column Open1 or Open2 or
Open3 
etc ...

I need to figure out which OpenN ( N = number ) he clicked on
...

Thanks again,

Sean.

--- In flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com , helihobby [EMAIL PROTECTED]
wrote:

 
 Hello,
 
 Can anyone help out ...
 I know the Data Grid Cell's Row and Colum Index.
 
 How can I retrieve the data in that cell if I know these two 
values ?
 
 Thank you,
 
 Sean.




 



[flexcoders] Re: Can anyone help on getting data from a grid cell .. I know the row/column index

2007-02-26 Thread sanjaypmg
Hi Sean,

you can do it by calling a method on itemClick of a dataGrid.

in this method you'll get the selected row of your Grid. thereafter 
you can access any particular cell's value by specifying dataField 
name like: evt.target.selectedItem.DataFieldNAME;



-- In flexcoders@yahoogroups.com, helihobby [EMAIL PROTECTED] wrote:

 Is it possible ?
 
 Sean.
 
 --- In flexcoders@yahoogroups.com, helihobby helihobby@ wrote:
 
  
  Hello,
  
  Can anyone help out ...
  I know the Data Grid Cell's Row and Colum Index.
  
  How can I retrieve the data in that cell if I know these two 
values ?
  
  Thank you,
  
  Sean.
 





Re: [flexcoders] Re: Can anyone help on getting data from a grid cell .. I know the row/column index

2007-02-26 Thread André Rodrigues Pena

It's not usual to access data from the grid, you access data from it's
dataprovider that is normally either a ArrayCollection or a XML object.

Imagine your grid has the following data provider:

var xml:XML =
package
employee id=0 name=Michael/
employee id=1 name=Roger/
/package;

So you can access data this way:

[EMAIL PROTECTED] will return Roger.
[EMAIL PROTECTED] will return 0







On 2/26/07, helihobby [EMAIL PROTECTED] wrote:


  Is it possible ?

Sean.

--- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com,
helihobby [EMAIL PROTECTED] wrote:


 Hello,

 Can anyone help out ...
 I know the Data Grid Cell's Row and Colum Index.

 How can I retrieve the data in that cell if I know these two values ?

 Thank you,

 Sean.


 





--
André Rodrigues Pena

LOCUS
www.locus.com.br

Blog
www.techbreak.org


[flexcoders] Re: Can anyone help on getting data from a grid cell .. I know the row/column index

2007-02-26 Thread helihobby
Thank you all for the answers ...
The problem is that I need to know which cell he clicked on.

Or in other words, what is the text that displayed on that cell...

Getting the complete ArrayCollection object which the user clicked on 
is easy as I can ( as u guys mentioned ) simply grab the event and do 
event.selectedItem.SOME_PROP_HERE

However, I need to know which prop he clicked on as during runtime I 
do not know the name of SOME_PROP_HERE.

In my case I have over 40 columns per row and each carries the name 
of Open1 Open2 Open3 Open4 . etc ...

So of course doing event.selectedItem.Open1 will work.

But how do I know if clicked on the column Open1 or Open2 or Open3 
etc ...


I need to figure out which OpenN ( N = number ) he clicked on ...

Thanks again,

Sean.



--- In flexcoders@yahoogroups.com, helihobby [EMAIL PROTECTED] wrote:

 
 Hello,
 
 Can anyone help out ...
 I know the Data Grid Cell's Row and Colum Index.
 
 How can I retrieve the data in that cell if I know these two 
values ?
 
 Thank you,
 
 Sean.





Re: [flexcoders] Re: Can anyone help on getting data from a grid cell .. I know the row/column index

2007-02-26 Thread leds usop
OMG i just realized I just gave you the reverse of
what you are asking for haha. my bad.   anyway, try
using datagrid's indicesToIndex() method. It will
return the index (in your dataprovider)... I assume
you can then look up your dataprovider to determine
which item/prop/text is which? :)

Cheers!

-leds


--- leds usop [EMAIL PROTECTED] wrote:

 Hi listen for the itemclickevent and then use
 specifically ListEvent as the event type paramter of
 the listener then use the rowIndex and columnindex
 properties like so:
 
 private function test(e:ListEvent):void{
 trace(e.rowIndex.toString());
 trace(e.columnIndex.toString());
 }
 
 be aware however that these indeces are relative to
 the visual grid, hence the headers (if you use them)
 are counted. Just compensate approprately.. like
 subtract 1 from the rowindex. :) Cheers!
 
 -leds
 
 
 
 --- helihobby [EMAIL PROTECTED] wrote:
 
  Thank you all for the answers ...
  The problem is that I need to know which cell he
  clicked on.
  
  Or in other words, what is the text that displayed
  on that cell...
  
  Getting the complete ArrayCollection object which
  the user clicked on 
  is easy as I can ( as u guys mentioned ) simply
 grab
  the event and do 
  event.selectedItem.SOME_PROP_HERE
  
  However, I need to know which prop he clicked on
 as
  during runtime I 
  do not know the name of SOME_PROP_HERE.
  
  In my case I have over 40 columns per row and each
  carries the name 
  of Open1 Open2 Open3 Open4 . etc ...
  
  So of course doing event.selectedItem.Open1 will
  work.
  
  But how do I know if clicked on the column Open1
 or
  Open2 or Open3 
  etc ...
  
  
  I need to figure out which OpenN ( N = number ) he
  clicked on ...
  
  Thanks again,
  
  Sean.
  
  
  
  --- In flexcoders@yahoogroups.com, helihobby
  [EMAIL PROTECTED] wrote:
  
   
   Hello,
   
   Can anyone help out ...
   I know the Data Grid Cell's Row and Colum Index.
   
   How can I retrieve the data in that cell if I
 know
  these two 
  values ?
   
   Thank you,
   
   Sean.
  
  
  
  
 
 
 
  


 Now that's room service!  Choose from over 150,000
 hotels
 in 45,000 destinations on Yahoo! Travel to find your
 fit.
 http://farechase.yahoo.com/promo-generic-14795097
 



 

No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 


Re: [flexcoders] Re: Can anyone help on getting data from a grid cell .. I know the row/column index

2007-02-26 Thread leds usop
I think my last lines are a bit vague and confusing.
It isnt the actual index in the dataprovider.. but
rather the offset in the data provider of properties
depending on how you have laid out your elements. So
the reliability of this method depends - needless to
say - your prior knowledge of how the properties are
to be laid out in the datagrid.  It's one of the
setbacks for trying to find the item from the visual
indeces  p 




--- leds usop [EMAIL PROTECTED] wrote:

 OMG i just realized I just gave you the reverse of
 what you are asking for haha. my bad.   anyway, try
 using datagrid's indicesToIndex() method. It will
 return the index (in your dataprovider)... I assume
 you can then look up your dataprovider to determine
 which item/prop/text is which? :)
 
 Cheers!
 
 -leds
 
 
 --- leds usop [EMAIL PROTECTED] wrote:
 
  Hi listen for the itemclickevent and then use
  specifically ListEvent as the event type paramter
 of
  the listener then use the rowIndex and columnindex
  properties like so:
  
  private function test(e:ListEvent):void{
  trace(e.rowIndex.toString());
  trace(e.columnIndex.toString());
  }
  
  be aware however that these indeces are relative
 to
  the visual grid, hence the headers (if you use
 them)
  are counted. Just compensate approprately.. like
  subtract 1 from the rowindex. :) Cheers!
  
  -leds
  
  
  
  --- helihobby [EMAIL PROTECTED] wrote:
  
   Thank you all for the answers ...
   The problem is that I need to know which cell he
   clicked on.
   
   Or in other words, what is the text that
 displayed
   on that cell...
   
   Getting the complete ArrayCollection object
 which
   the user clicked on 
   is easy as I can ( as u guys mentioned ) simply
  grab
   the event and do 
   event.selectedItem.SOME_PROP_HERE
   
   However, I need to know which prop he clicked on
  as
   during runtime I 
   do not know the name of SOME_PROP_HERE.
   
   In my case I have over 40 columns per row and
 each
   carries the name 
   of Open1 Open2 Open3 Open4 . etc ...
   
   So of course doing event.selectedItem.Open1 will
   work.
   
   But how do I know if clicked on the column Open1
  or
   Open2 or Open3 
   etc ...
   
   
   I need to figure out which OpenN ( N = number )
 he
   clicked on ...
   
   Thanks again,
   
   Sean.
   
   
   
   --- In flexcoders@yahoogroups.com, helihobby
   [EMAIL PROTECTED] wrote:
   

Hello,

Can anyone help out ...
I know the Data Grid Cell's Row and Colum
 Index.

How can I retrieve the data in that cell if I
  know
   these two 
   values ?

Thank you,

Sean.
   
   
   
   
  
  
  
   
 


  Now that's room service!  Choose from over 150,000
  hotels
  in 45,000 destinations on Yahoo! Travel to find
 your
  fit.
  http://farechase.yahoo.com/promo-generic-14795097
  
 
 
 
  


 No need to miss a message. Get email on-the-go 
 with Yahoo! Mail for Mobile. Get started.
 http://mobile.yahoo.com/mail 
 



 

Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather


[flexcoders] Re: Can anyone help on getting data from a grid cell .. I know the row/column index

2007-02-26 Thread helihobby
Found the solution from a guy who emailed me ... thx

This is what worked for me:


yourDataGrid.addEventListener(ListEvent.ITEM_CLICK, setColumnCopy);

function setColumnCopy(){

_selectedCol = yourDataGrid.columns[event.columnIndex].dataField;

Alert.show(yourDataGrid.selectedItem[_selectedCol]);

}



As always, Thank you for all the help and support.

BRA 
HREF=http://www.helihobby.com/html/alon_desingpattern.html;FONT 
SIZE=-1 FACE=Verdana,Tahoma,Arial,Helvetica,Sans-serifRead my 
solution for Flex Component communication here.../FONT/A

BRSean - A HREF=http://www.helihobby.com;FONT SIZE=-1 
FACE=Verdana,Tahoma,Arial,Helvetica,Sans-serifHeliHobby.com/FONT



[flexcoders] Re: Can anyone help on getting data from a grid cell .. I know the row/column index

2007-02-26 Thread helihobby
As always, Thank you for all the help and support.

Regards,

Sean - http://www.HeliHobby.com

P.S.

You can read my solution for Flex Component communication here:

http://www.helihobby.com/html/alon_desingpattern.html


--- In flexcoders@yahoogroups.com, helihobby [EMAIL PROTECTED] wrote:

 Found the solution from a guy who emailed me ... thx
 
 This is what worked for me:
 
 
 yourDataGrid.addEventListener(ListEvent.ITEM_CLICK, setColumnCopy);
 
 function setColumnCopy(){
 
 _selectedCol = yourDataGrid.columns[event.columnIndex].dataField;
 
 Alert.show(yourDataGrid.selectedItem[_selectedCol]);
 
 }
 
 
 
 As always, Thank you for all the help and support.
 
 BRA 
 HREF=http://www.helihobby.com/html/alon_desingpattern.html;FONT 
 SIZE=-1 FACE=Verdana,Tahoma,Arial,Helvetica,Sans-serifRead my 
 solution for Flex Component communication here.../FONT/A
 
 BRSean - A HREF=http://www.helihobby.com;FONT SIZE=-1 
 FACE=Verdana,Tahoma,Arial,Helvetica,Sans-
serifHeliHobby.com/FONT





[flexcoders] Re: Can anyone help on getting data from a grid cell .. I know the row/column index

2007-02-25 Thread helihobby
Is it possible ?

Sean.

--- In flexcoders@yahoogroups.com, helihobby [EMAIL PROTECTED] wrote:

 
 Hello,
 
 Can anyone help out ...
 I know the Data Grid Cell's Row and Colum Index.
 
 How can I retrieve the data in that cell if I know these two values ?
 
 Thank you,
 
 Sean.





[flexcoders] Re: Can anyone help on getting data from a grid cell .. I know the row/column index

2007-02-25 Thread wayne_badu_johnson
Hi Sean

Have a look in help for 'datagrid event':

?xml version=1.0?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
mx:Script
![CDATA[
import mx.events.ListEvent;
private function itemClickEvent(event:ListEvent):void {
clickColumn.text=String(event.columnIndex);
clickRow.text=String(event.rowIndex);
eventType.text=event.type;
}
]]
/mx:Script
mx:DataGrid id=myGrid width=350 height=150
itemClick=itemClickEvent(event);
mx:ArrayCollection
mx:Object Artist=Pavement Price=11.99 
Album=Slanted and Enchanted /
mx:Object Artist=Pavement Album=Brighten the Corners
Price=11.99 /
/mx:ArrayCollection
/mx:DataGrid 

mx:TextArea id=clickColumn /
mx:TextArea id=clickRow /
mx:TextArea id=eventType /
/mx:Application 


To access the selected item in the event handler, you can use the 
currentTarget property of the event object, and the selectedItem 
property of the DataGrid control, as the following code shows:

var selectedArtist:String=event.currentTarget.selectedItem.Artist;


Cheers
Wayne

--- In flexcoders@yahoogroups.com, helihobby [EMAIL PROTECTED] wrote:

 Is it possible ?
 
 Sean.
 
 --- In flexcoders@yahoogroups.com, helihobby helihobby@ wrote:
 
  
  Hello,
  
  Can anyone help out ...
  I know the Data Grid Cell's Row and Colum Index.
  
  How can I retrieve the data in that cell if I know these two 
values ?
  
  Thank you,
  
  Sean.