If it does what you want cool. It’s
completely unsupported J
From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, October 12, 2005
2:02 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Reading the displayed
value in a DataGrid - How to
I just noticed that this post never made it to the
list ......
----- Forwarded by Oscar
Cortes/ServiceCenter/US/SunLife on 10/12/2005
02:01 PM -----
Oscar
Cortes
To: flexcoders@yahoogroups.com
10/12/2005 09:48
AM
cc:
Subject: RE: [flexcoders] Reading the displayed value in a DataGrid -
How
to(Document link: Oscar
Cortes)
Thanks Matt, I might give this a try. I ended up
using something like this
which also works:
For (var i:Number=0; I < dg.rowcount; i++)
{
For (var
j:Number=0; I < dg.columns.length; j++)
{
myHTML += dg.rows[i].cells[j].value;
}
}
As I said, this works and makes sense. It reads
what it is in the cell and
not what it is in the dataprovider for the same
position. However, it is
not documented I believe. I found something
similar in the Macromedia
forums. Any comments?
Thanks,
-Oscar.
"Matt
Chotin"
To: flexcoders@yahoogroups.com
<[EMAIL PROTECTED]>
cc:
Sent
by:
Subject: RE: [flexcoders] Reading the displayed value in a DataGrid -
How
flexcoders@yahoogroups.com
to
10/11/2005 11:00
PM
Please respond
to
flexcoders
How about something like this?
For (var i:Number=0; I <
dg.dataProvider.length; i++)
{
var cells:Array = [];
var item:Object =
dg.dataProvider.getItemAt(i);
for (var c:Number=0; c <
dg.columns.length; c++)
{
var
col:mx.controls.gridclasses.DataGridColumn = dg.getColumnAt( c );
if (c.labelFunction !=
undefined)
{
cells.push(c.labelFunction(item));
}
else
{
Cells.push(item[c.columnName]);
}
}
//do something with cells to build your
HTML
}
Matt
From: flexcoders@yahoogroups.com
[mailto:flexcoders@yahoogroups.com]
On
Behalf Of [EMAIL PROTECTED]
Sent: Monday, October 10, 2005 2:32 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Reading the displayed
value in a DataGrid - How
to
Let me reformulate my question. Usually you can
use selectedItem.
columnName to read the value of a
row/column of a datagrid. This seems to
work fine as shown in the Flex Sample Explorer (
example below). But how
can you read the value of a computed column that
was added in addition to
the columns returned by the
dataprovider? When I trace the selectedItem
or getItemAt, I only get the dataprovider data and
nothing else.
<mx:DataGrid id="dg"
width="100%" height="100%"
dataProvider="{employeeModel.employee}">
<mx:columns>
<mx:Array>
<mx:DataGridColumn columnName="name" headerText="Name"/>
<mx:DataGridColumn columnName="phone"
headerText="Phone"/>
<mx:DataGridColumn columnName="email"
headerText="Email"/>
<!--
How can I read this? -->
<mx:DataGridColumn columnName="myComputedColumn"
headerText="All"
labelFunction="cocanateAll"/>
<!-- No part of the dataprovider,
but shows OK -->
</mx:Array>
</mx:columns>
</mx:DataGrid>
<mx:Form>
<mx:FormItem label="Name">
<mx:Label text="{dg.selectedItem.name}"/>
</mx:FormItem>
<mx:FormItem label="Email">
<mx:Label text="{dg.selectedItem.email}"/>
</mx:FormItem>
<mx:FormItem label="Phone">
<mx:Label text="{dg.selectedItem.phone}"/>
</mx:FormItem>
<!--
How can I read this? -->
<mx:FormItem label="">
<mx:Label text="{dg.selectedItem.myComputedColumn}"/> <!--
This doesn't work -->
</mx:FormItem>
<!--
-->
Thanks,
</mx:Form>
[EMAIL PROTECTED]
To:
flexcoders@yahoogroups.com
Sent
by:
cc:
flexcoders@yahoogroups.com
Subject: [flexcoders]
Reading the displayed value in a DataGrid - How to
10/10/2005 12:45 PM
Please respond to
flexcoders
I am using labelFunction for a column in a
datagrid. How can I read the
displayed value and not the real value directly
from the dataGrid?
I am also wondering how to get values from the
DataGrid in general. I need
to render the DataGrid to a HTML table, I mean,
read columns and rows from
the dataGrid and have a string with the HTML
syntax. I could not find
anything such as getRow, and then read each
column. So I am selecting each
Row and then using the selectedItem property.
I know that I could use the function executed in
labelFunction to
reproduce the displayed value, but I am actually
trying to extend the
DataGrid class and add a method called
getHTMLString for example. This
would require to be agnostic of whether the column
has a labelFunction or
not.
Any ideas?
Thanks.
---------------------------------------------------------------------------
This e-mail message (including attachments, if
any) is intended for the use
of the individual or entity to which it is
addressed and may contain
information that is privileged, proprietary ,
confidential and exempt from
disclosure. If you are not the intended
recipient, you are notified that
any dissemination, distribution or copying of this
communication is
strictly prohibited. If you have received
this communication in error,
please notify the sender and erase this e-mail
message immediately.
---------------------------------------------------------------------------
--
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
---------------------------------------------------------------------------
This e-mail message (including attachments, if
any) is intended for the use
of the individual or entity to which it is
addressed and may contain
information that is privileged, proprietary ,
confidential and exempt from
disclosure. If you are not the intended
recipient, you are notified that
any dissemination, distribution or copying of this
communication is
strictly prohibited. If you have received
this communication in error,
please notify the sender and erase this e-mail
message immediately.
---------------------------------------------------------------------------
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Web site design Computer software
Software design
development
development and development
Macromedia flex
Software
development best
practice
YAHOO! GROUPS LINKS
Visit your
group "flexcoders" on the web.
To
unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of
Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------------------------------------------------
This e-mail message (including attachments, if
any) is intended for the use
of the individual or entity to which it is
addressed and may contain
information that is privileged, proprietary ,
confidential and exempt from
disclosure. If you are not the intended
recipient, you are notified that
any dissemination, distribution or copying of this
communication is
strictly prohibited. If you have received
this communication in error,
please notify the sender and erase this e-mail
message immediately.
---------------------------------------------------------------------------
--
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