RE: [flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-13 Thread Tracy Spratt
First, to make it completely clear, when working with the data, you must
always use the underlying dataProvider and item and never the DataGrid or
cell itself.  This is because itemRenderers are recycled.  You can never do
any row level work in a renderer in creationComplete for the same reason,
but must override the set data() function.  Google this.

 

Also, if I am understanding correctly, there are two other ways to do this.

 

You mentioned labelFunction.  That is one way. A label function has access
to the entire row item, and can use the values of any property/cell for the
display logic.

 

You could also create a value object with a calculated property.

 

Note that if you update the dataProvider programmatically, you should use
the dataProvider collection API in order to ensure the correct events are
dispatched to update the UI.  You can call itemUpdated() if you assign the
value of an item.property directly.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Craig
Sent: Sunday, July 12, 2009 11:58 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: This is not as easy as it seems ... apparently...

 






--- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
"postwick"  wrote:

thank you, sir... I appreciate your help, I shall do as you say !!

Craig

>
> That'll update the value of the cell. 
> 
> You can't do what you're trying to do. You can't have a column with a
different dataField per row. The dataField for the column is the same for
every row.
> 
> Is this data coming from a database, through a view? You really should do
this there. You can set up a view column with an if/then that returns the
column's value you want.
> 
> --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
"Craig"  wrote:
> >
> > now we're getting somewhere! but will this update the value of the col2
or the value of col2 DataField?
> > 
> > I am trying to change the value of col2 DataField to "Profit" not the
value of col2 itself.
> > 
> > Can I use:
> > 
> > dgOrdExt.getChildAt(i)["Profit"].dataField = "Profit"
> > 
> > CS
> > 
> > 
> > 
> > 
> > --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com>
ups.com, "postwick"  wrote:
> > >
> > > You can't use selectedItem because there is no selectedItem. You
haven't clicked a row. Try looping through the grid.
> > > 
> > > In the end, I really don't understand why you don't do this in the
dataCollection, or even in the source data.
> > > 
> > > for (var i:Number = 0; i < mygrid.numChildren; i++) {
> > > if (mygrid.getChildAt(i)["Kind"] == "LONG") {
> > > mygrid.getChildAt(i)["Profit"] = "Profit";
> > > }
> > > else { mygrid.getChildAt(i)["Profit"] = "ShProfit"; }
> > > 
> > > --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com>
ups.com, "Craig"  wrote:
> > > >
> > > > Ok... In the parent component to the datagrid I used an initialize
event:
> > > > 
> > > > public function initDg():void {
> > > > 
> > > >
if(dgOrdExt.selectedItem["Kind"]=="LONG")dgOrdExt.Profit.dataField="Profit";
> > > >
if(dgOrdExt.selectedItem["Kind"]=="SHORT")dgOrdExt.Profit.dataField="ShProfi
t";
> > > > 
> > > > }
> > > > 
> > > > it does not work. but if I replace the code with
dgOrdExt.dataField="Profit"; which just sets the dataField without
referencing the other column the code is all working... 
> > > > 
> > > > I also tried creationcomplete event and that did not work either.
> > > > 
> > > > 
> > > > 
> > > > --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com>
ups.com, "Craig"  wrote:
> > > > >
> > > > > cause I was doing it within the custom component (column) itself
for the datagrid, which can not hold an Id value, I can put it in the parent
component however i'll give that a whack.
> > > > > 
> > > > > 
> > > > > --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com>
ups.com, "postwick"  wrote:
> > > > > >
> > > > > > Not sure why you have all the Application.application stuff on
there. Just reference the datagrid by it's id.
> > &

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread Craig
--- In flexcoders@yahoogroups.com, "postwick"  wrote:

thank you, sir... I appreciate your help, I shall do as you say  !!

Craig


>
> That'll update the value of the cell.  
> 
> You can't do what you're trying to do.  You can't have a column with a 
> different dataField per row.  The dataField for the column is the same for 
> every row.
> 
> Is this data coming from a database, through a view?  You really should do 
> this there.  You can set up a view column with an if/then that returns the 
> column's value you want.
> 
> --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> >
> > now we're getting somewhere!  but will this update the value of the col2 or 
> > the value of col2 DataField?
> > 
> > I am trying to change the value of col2 DataField to "Profit" not the value 
> > of col2 itself.
> > 
> > Can I use:
> > 
> > dgOrdExt.getChildAt(i)["Profit"].dataField = "Profit"
> > 
> > CS
> > 
> > 
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > >
> > > You can't use selectedItem because there is no selectedItem.  You haven't 
> > > clicked a row.  Try looping through the grid.
> > > 
> > > In the end, I really don't understand why you don't do this in the 
> > > dataCollection, or even in the source data.
> > > 
> > > for (var i:Number = 0; i < mygrid.numChildren; i++) {
> > >   if (mygrid.getChildAt(i)["Kind"] == 
> > > "LONG") {
> > >   mygrid.getChildAt(i)["Profit"] 
> > > = "Profit";
> > >   }
> > > else { mygrid.getChildAt(i)["Profit"] = "ShProfit"; }
> > > 
> > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > >
> > > > Ok... In the parent component to the datagrid I used an initialize 
> > > > event:
> > > > 
> > > >  public function initDg():void  {
> > > > 
> > > > if(dgOrdExt.selectedItem["Kind"]=="LONG")dgOrdExt.Profit.dataField="Profit";
> > > > if(dgOrdExt.selectedItem["Kind"]=="SHORT")dgOrdExt.Profit.dataField="ShProfit";
> > > > 
> > > > }
> > > > 
> > > > it does not work.  but if I replace the code with 
> > > > dgOrdExt.dataField="Profit"; which just sets the dataField without 
> > > > referencing the other column the code is all working... 
> > > > 
> > > > I also tried creationcomplete event and that did not work either.
> > > > 
> > > > 
> > > > 
> > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > >
> > > > > cause I was doing it within the custom component (column) itself for 
> > > > > the datagrid, which can not hold an Id value, I can put it in the 
> > > > > parent component however i'll give that a whack.
> > > > > 
> > > > > 
> > > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > > >
> > > > > > Not sure why you have all the Application.application stuff on 
> > > > > > there.  Just reference the datagrid by it's id.
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > mygrid.selectedItem["columname"] = "some value"
> > > > > > 
> > > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > > >
> > > > > > > From within the custom component DataGrid Column I tried this 
> > > > > > > code as you suggested at the initialize event but it errors:
> > > > > > > 
> > > > > > >   
> > > > > > > if(Application.application.CnvPos.dgOrdExt.selectedItem["Kind"]=="LONG")
> > > > > > >  Profit.dataField="Profit";
> > > > > > > 
> > > > > > > 
> > > > > > > I don't think the selecteditem field is the answer.
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > > > >
> > > > > > > > yes the datagrid is bound to an array collection.
> > > > > > > > I don't want to select any item, I want to change the value of 
> > > > > > > > a column's DataField to a one of two values based on the value 
> > > > > > > > of another column's output.
> > > > > > > > 
> > > > > > > > I don't want to have to 'selecteditem' but I can try that code 
> > > > > > > > below are you suggesting that I use it in the labelfunction of 
> > > > > > > > the datagrid column that I am trying to change?
> > > > > > > > 
> > > > > > > > 
> > > > > > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > > > > > >
> > > > > > > > > Is the datagrid bound to a collection?  if so, change the 
> > > > > > > > > value in the collection.
> > > > > > > > > 
> > > > > > > > > or try...
> > > > > > > > > 
> > > > > > > > > yourDataGrid.selectedItem["dataColumn1"] = 
> > > > > > > > > yourDataGrid.selectedItem["dataColumn2"]
> > > > > > > > > 
> > > > > > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > > > > > >
> > > > > > > > > > I am trying to set the value of a column based on the value 
> > > > > > > > > > of another column.  If I use ...selectedItem... it does not 
> > > > > > > > > > work, unless I am mistaken.
> > > > > > > > > > 
> > > > > > > > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > > > > > > > >

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread postwick
That'll update the value of the cell.  

You can't do what you're trying to do.  You can't have a column with a 
different dataField per row.  The dataField for the column is the same for 
every row.

Is this data coming from a database, through a view?  You really should do this 
there.  You can set up a view column with an if/then that returns the column's 
value you want.

--- In flexcoders@yahoogroups.com, "Craig"  wrote:
>
> now we're getting somewhere!  but will this update the value of the col2 or 
> the value of col2 DataField?
> 
> I am trying to change the value of col2 DataField to "Profit" not the value 
> of col2 itself.
> 
> Can I use:
> 
> dgOrdExt.getChildAt(i)["Profit"].dataField = "Profit"
> 
> CS
> 
> 
> 
> 
> --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> >
> > You can't use selectedItem because there is no selectedItem.  You haven't 
> > clicked a row.  Try looping through the grid.
> > 
> > In the end, I really don't understand why you don't do this in the 
> > dataCollection, or even in the source data.
> > 
> > for (var i:Number = 0; i < mygrid.numChildren; i++) {
> > if (mygrid.getChildAt(i)["Kind"] == 
> > "LONG") {
> > mygrid.getChildAt(i)["Profit"] 
> > = "Profit";
> > }
> > else { mygrid.getChildAt(i)["Profit"] = "ShProfit"; }
> > 
> > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > >
> > > Ok... In the parent component to the datagrid I used an initialize event:
> > > 
> > >  public function initDg():void{
> > > 
> > > if(dgOrdExt.selectedItem["Kind"]=="LONG")dgOrdExt.Profit.dataField="Profit";
> > > if(dgOrdExt.selectedItem["Kind"]=="SHORT")dgOrdExt.Profit.dataField="ShProfit";
> > > 
> > > }
> > > 
> > > it does not work.  but if I replace the code with 
> > > dgOrdExt.dataField="Profit"; which just sets the dataField without 
> > > referencing the other column the code is all working... 
> > > 
> > > I also tried creationcomplete event and that did not work either.
> > > 
> > > 
> > > 
> > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > >
> > > > cause I was doing it within the custom component (column) itself for 
> > > > the datagrid, which can not hold an Id value, I can put it in the 
> > > > parent component however i'll give that a whack.
> > > > 
> > > > 
> > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > >
> > > > > Not sure why you have all the Application.application stuff on there. 
> > > > >  Just reference the datagrid by it's id.
> > > > > 
> > > > > 
> > > > > 
> > > > > mygrid.selectedItem["columname"] = "some value"
> > > > > 
> > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > >
> > > > > > From within the custom component DataGrid Column I tried this code 
> > > > > > as you suggested at the initialize event but it errors:
> > > > > > 
> > > > > > 
> > > > > > if(Application.application.CnvPos.dgOrdExt.selectedItem["Kind"]=="LONG")
> > > > > >  Profit.dataField="Profit";
> > > > > > 
> > > > > > 
> > > > > > I don't think the selecteditem field is the answer.
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > > >
> > > > > > > yes the datagrid is bound to an array collection.
> > > > > > > I don't want to select any item, I want to change the value of a 
> > > > > > > column's DataField to a one of two values based on the value of 
> > > > > > > another column's output.
> > > > > > > 
> > > > > > > I don't want to have to 'selecteditem' but I can try that code 
> > > > > > > below are you suggesting that I use it in the labelfunction of 
> > > > > > > the datagrid column that I am trying to change?
> > > > > > > 
> > > > > > > 
> > > > > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > > > > >
> > > > > > > > Is the datagrid bound to a collection?  if so, change the value 
> > > > > > > > in the collection.
> > > > > > > > 
> > > > > > > > or try...
> > > > > > > > 
> > > > > > > > yourDataGrid.selectedItem["dataColumn1"] = 
> > > > > > > > yourDataGrid.selectedItem["dataColumn2"]
> > > > > > > > 
> > > > > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > > > > >
> > > > > > > > > I am trying to set the value of a column based on the value 
> > > > > > > > > of another column.  If I use ...selectedItem... it does not 
> > > > > > > > > work, unless I am mistaken.
> > > > > > > > > 
> > > > > > > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > > > > > > >
> > > > > > > > > > You access the value in a column of a datagrid like this...
> > > > > > > > > > 
> > > > > > > > > > yourDataGrid.selectedItem["dataColumnNameOfColumn"]
> > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > > > > > > >
> > > > > > > > > > > I GIVE UP!! I have tried ev

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread Craig
now we're getting somewhere!  but will this update the value of the col2 or the 
value of col2 DataField?

I am trying to change the value of col2 DataField to "Profit" not the value of 
col2 itself.

Can I use:

dgOrdExt.getChildAt(i)["Profit"].dataField = "Profit"

CS




--- In flexcoders@yahoogroups.com, "postwick"  wrote:
>
> You can't use selectedItem because there is no selectedItem.  You haven't 
> clicked a row.  Try looping through the grid.
> 
> In the end, I really don't understand why you don't do this in the 
> dataCollection, or even in the source data.
> 
> for (var i:Number = 0; i < mygrid.numChildren; i++) {
>   if (mygrid.getChildAt(i)["Kind"] == 
> "LONG") {
>   mygrid.getChildAt(i)["Profit"] 
> = "Profit";
>   }
> else { mygrid.getChildAt(i)["Profit"] = "ShProfit"; }
> 
> --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> >
> > Ok... In the parent component to the datagrid I used an initialize event:
> > 
> >  public function initDg():void  {
> > 
> > if(dgOrdExt.selectedItem["Kind"]=="LONG")dgOrdExt.Profit.dataField="Profit";
> > if(dgOrdExt.selectedItem["Kind"]=="SHORT")dgOrdExt.Profit.dataField="ShProfit";
> > 
> > }
> > 
> > it does not work.  but if I replace the code with 
> > dgOrdExt.dataField="Profit"; which just sets the dataField without 
> > referencing the other column the code is all working... 
> > 
> > I also tried creationcomplete event and that did not work either.
> > 
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > >
> > > cause I was doing it within the custom component (column) itself for the 
> > > datagrid, which can not hold an Id value, I can put it in the parent 
> > > component however i'll give that a whack.
> > > 
> > > 
> > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > >
> > > > Not sure why you have all the Application.application stuff on there.  
> > > > Just reference the datagrid by it's id.
> > > > 
> > > > 
> > > > 
> > > > mygrid.selectedItem["columname"] = "some value"
> > > > 
> > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > >
> > > > > From within the custom component DataGrid Column I tried this code as 
> > > > > you suggested at the initialize event but it errors:
> > > > > 
> > > > >   
> > > > > if(Application.application.CnvPos.dgOrdExt.selectedItem["Kind"]=="LONG")
> > > > >  Profit.dataField="Profit";
> > > > > 
> > > > > 
> > > > > I don't think the selecteditem field is the answer.
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > >
> > > > > > yes the datagrid is bound to an array collection.
> > > > > > I don't want to select any item, I want to change the value of a 
> > > > > > column's DataField to a one of two values based on the value of 
> > > > > > another column's output.
> > > > > > 
> > > > > > I don't want to have to 'selecteditem' but I can try that code 
> > > > > > below are you suggesting that I use it in the labelfunction of the 
> > > > > > datagrid column that I am trying to change?
> > > > > > 
> > > > > > 
> > > > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > > > >
> > > > > > > Is the datagrid bound to a collection?  if so, change the value 
> > > > > > > in the collection.
> > > > > > > 
> > > > > > > or try...
> > > > > > > 
> > > > > > > yourDataGrid.selectedItem["dataColumn1"] = 
> > > > > > > yourDataGrid.selectedItem["dataColumn2"]
> > > > > > > 
> > > > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > > > >
> > > > > > > > I am trying to set the value of a column based on the value of 
> > > > > > > > another column.  If I use ...selectedItem... it does not work, 
> > > > > > > > unless I am mistaken.
> > > > > > > > 
> > > > > > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > > > > > >
> > > > > > > > > You access the value in a column of a datagrid like this...
> > > > > > > > > 
> > > > > > > > > yourDataGrid.selectedItem["dataColumnNameOfColumn"]
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > > > > > >
> > > > > > > > > > I GIVE UP!! I have tried everything!!.. I have a dataGrid 
> > > > > > > > > > that binds to
> > > > > > > > > > an ArrayCollection.  I need to change the value of one 
> > > > > > > > > > columen (Profit)
> > > > > > > > > > based on the value of another column (Kind) ie.. the 
> > > > > > > > > > results (either
> > > > > > > > > > 'LONG' or SHORT').  Here is where I'm at.  I've tried 
> > > > > > > > > > putting code into
> > > > > > > > > > customer DataGridColumns and labelFunctions and 
> > > > > > > > > > ItemRenderers... but can
> > > > > > > > > > not do it.  What seem to be working most are events in the 
> > > > > > > > > > DataGrid
> > > > > > > > > > Component, better

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread postwick
You can't use selectedItem because there is no selectedItem.  You haven't 
clicked a row.  Try looping through the grid.

In the end, I really don't understand why you don't do this in the 
dataCollection, or even in the source data.

for (var i:Number = 0; i < mygrid.numChildren; i++) {
if (mygrid.getChildAt(i)["Kind"] == 
"LONG") {
mygrid.getChildAt(i)["Profit"] 
= "Profit";
}
else { mygrid.getChildAt(i)["Profit"] = "ShProfit"; }

--- In flexcoders@yahoogroups.com, "Craig"  wrote:
>
> Ok... In the parent component to the datagrid I used an initialize event:
> 
>  public function initDg():void{
> 
> if(dgOrdExt.selectedItem["Kind"]=="LONG")dgOrdExt.Profit.dataField="Profit";
> if(dgOrdExt.selectedItem["Kind"]=="SHORT")dgOrdExt.Profit.dataField="ShProfit";
> 
> }
> 
> it does not work.  but if I replace the code with 
> dgOrdExt.dataField="Profit"; which just sets the dataField without 
> referencing the other column the code is all working... 
> 
> I also tried creationcomplete event and that did not work either.
> 
> 
> 
> --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> >
> > cause I was doing it within the custom component (column) itself for the 
> > datagrid, which can not hold an Id value, I can put it in the parent 
> > component however i'll give that a whack.
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > >
> > > Not sure why you have all the Application.application stuff on there.  
> > > Just reference the datagrid by it's id.
> > > 
> > > 
> > > 
> > > mygrid.selectedItem["columname"] = "some value"
> > > 
> > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > >
> > > > From within the custom component DataGrid Column I tried this code as 
> > > > you suggested at the initialize event but it errors:
> > > > 
> > > > 
> > > > if(Application.application.CnvPos.dgOrdExt.selectedItem["Kind"]=="LONG")
> > > >  Profit.dataField="Profit";
> > > > 
> > > > 
> > > > I don't think the selecteditem field is the answer.
> > > > 
> > > > 
> > > > 
> > > > 
> > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > >
> > > > > yes the datagrid is bound to an array collection.
> > > > > I don't want to select any item, I want to change the value of a 
> > > > > column's DataField to a one of two values based on the value of 
> > > > > another column's output.
> > > > > 
> > > > > I don't want to have to 'selecteditem' but I can try that code below 
> > > > > are you suggesting that I use it in the labelfunction of the datagrid 
> > > > > column that I am trying to change?
> > > > > 
> > > > > 
> > > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > > >
> > > > > > Is the datagrid bound to a collection?  if so, change the value in 
> > > > > > the collection.
> > > > > > 
> > > > > > or try...
> > > > > > 
> > > > > > yourDataGrid.selectedItem["dataColumn1"] = 
> > > > > > yourDataGrid.selectedItem["dataColumn2"]
> > > > > > 
> > > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > > >
> > > > > > > I am trying to set the value of a column based on the value of 
> > > > > > > another column.  If I use ...selectedItem... it does not work, 
> > > > > > > unless I am mistaken.
> > > > > > > 
> > > > > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > > > > >
> > > > > > > > You access the value in a column of a datagrid like this...
> > > > > > > > 
> > > > > > > > yourDataGrid.selectedItem["dataColumnNameOfColumn"]
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > > > > >
> > > > > > > > > I GIVE UP!! I have tried everything!!.. I have a dataGrid 
> > > > > > > > > that binds to
> > > > > > > > > an ArrayCollection.  I need to change the value of one 
> > > > > > > > > columen (Profit)
> > > > > > > > > based on the value of another column (Kind) ie.. the results 
> > > > > > > > > (either
> > > > > > > > > 'LONG' or SHORT').  Here is where I'm at.  I've tried putting 
> > > > > > > > > code into
> > > > > > > > > customer DataGridColumns and labelFunctions and 
> > > > > > > > > ItemRenderers... but can
> > > > > > > > > not do it.  What seem to be working most are events in the 
> > > > > > > > > DataGrid
> > > > > > > > > Component, better than others, but comparing values in a 
> > > > > > > > > DataGrid is
> > > > > > > > > obviously impossible.
> > > > > > > > > 
> > > > > > > > > Somehow I need the code to access ArrayCollection getItemat() 
> > > > > > > > > but I
> > > > > > > > > can't do it!
> > > > > > > > > 
> > > > > > > > > Please help!
> > > > > > > > > 
> > > > > > > > > http://www.adobe.com/2006/mxml";
> > > > > > > > >  initialize="initTA()">
> > > > > > > > > 
> > > > > > > > >   > > > > > > > >  headerText="Kind"
> > > > > > >

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread Craig
Ok... In the parent component to the datagrid I used an initialize event:

 public function initDg():void  {

if(dgOrdExt.selectedItem["Kind"]=="LONG")dgOrdExt.Profit.dataField="Profit";
if(dgOrdExt.selectedItem["Kind"]=="SHORT")dgOrdExt.Profit.dataField="ShProfit";

}

it does not work.  but if I replace the code with dgOrdExt.dataField="Profit"; 
which just sets the dataField without referencing the other column the code is 
all working... 

I also tried creationcomplete event and that did not work either.



--- In flexcoders@yahoogroups.com, "Craig"  wrote:
>
> cause I was doing it within the custom component (column) itself for the 
> datagrid, which can not hold an Id value, I can put it in the parent 
> component however i'll give that a whack.
> 
> 
> --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> >
> > Not sure why you have all the Application.application stuff on there.  Just 
> > reference the datagrid by it's id.
> > 
> > 
> > 
> > mygrid.selectedItem["columname"] = "some value"
> > 
> > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > >
> > > From within the custom component DataGrid Column I tried this code as you 
> > > suggested at the initialize event but it errors:
> > > 
> > >   
> > > if(Application.application.CnvPos.dgOrdExt.selectedItem["Kind"]=="LONG") 
> > > Profit.dataField="Profit";
> > > 
> > > 
> > > I don't think the selecteditem field is the answer.
> > > 
> > > 
> > > 
> > > 
> > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > >
> > > > yes the datagrid is bound to an array collection.
> > > > I don't want to select any item, I want to change the value of a 
> > > > column's DataField to a one of two values based on the value of another 
> > > > column's output.
> > > > 
> > > > I don't want to have to 'selecteditem' but I can try that code below 
> > > > are you suggesting that I use it in the labelfunction of the datagrid 
> > > > column that I am trying to change?
> > > > 
> > > > 
> > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > >
> > > > > Is the datagrid bound to a collection?  if so, change the value in 
> > > > > the collection.
> > > > > 
> > > > > or try...
> > > > > 
> > > > > yourDataGrid.selectedItem["dataColumn1"] = 
> > > > > yourDataGrid.selectedItem["dataColumn2"]
> > > > > 
> > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > >
> > > > > > I am trying to set the value of a column based on the value of 
> > > > > > another column.  If I use ...selectedItem... it does not work, 
> > > > > > unless I am mistaken.
> > > > > > 
> > > > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > > > >
> > > > > > > You access the value in a column of a datagrid like this...
> > > > > > > 
> > > > > > > yourDataGrid.selectedItem["dataColumnNameOfColumn"]
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > > > >
> > > > > > > > I GIVE UP!! I have tried everything!!.. I have a dataGrid that 
> > > > > > > > binds to
> > > > > > > > an ArrayCollection.  I need to change the value of one columen 
> > > > > > > > (Profit)
> > > > > > > > based on the value of another column (Kind) ie.. the results 
> > > > > > > > (either
> > > > > > > > 'LONG' or SHORT').  Here is where I'm at.  I've tried putting 
> > > > > > > > code into
> > > > > > > > customer DataGridColumns and labelFunctions and 
> > > > > > > > ItemRenderers... but can
> > > > > > > > not do it.  What seem to be working most are events in the 
> > > > > > > > DataGrid
> > > > > > > > Component, better than others, but comparing values in a 
> > > > > > > > DataGrid is
> > > > > > > > obviously impossible.
> > > > > > > > 
> > > > > > > > Somehow I need the code to access ArrayCollection getItemat() 
> > > > > > > > but I
> > > > > > > > can't do it!
> > > > > > > > 
> > > > > > > > Please help!
> > > > > > > > 
> > > > > > > > http://www.adobe.com/2006/mxml";
> > > > > > > >  initialize="initTA()">
> > > > > > > > 
> > > > > > > >   > > > > > > >  headerText="Kind"
> > > > > > > >  dataField="Kind"
> > > > > > > >  
> > > > > > > > itemRenderer="com.steury.baseClasses.CellFieldTrd"/>
> > > > > > > >   > > > > > > >  headerText="Profit"/>
> > > > > > > > 
> > > > > > > >  
> > > > > > > >  

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread Craig
>From within the custom component DataGrid Column I tried this code as you 
>suggested at the initialize event but it errors:


if(Application.application.CnvPos.dgOrdExt.selectedItem["Kind"]=="LONG") 
Profit.dataField="Profit";


I don't think the selecteditem field is the answer.




--- In flexcoders@yahoogroups.com, "Craig"  wrote:
>
> yes the datagrid is bound to an array collection.
> I don't want to select any item, I want to change the value of a column's 
> DataField to a one of two values based on the value of another column's 
> output.
> 
> I don't want to have to 'selecteditem' but I can try that code below are you 
> suggesting that I use it in the labelfunction of the datagrid column that I 
> am trying to change?
> 
> 
> --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> >
> > Is the datagrid bound to a collection?  if so, change the value in the 
> > collection.
> > 
> > or try...
> > 
> > yourDataGrid.selectedItem["dataColumn1"] = 
> > yourDataGrid.selectedItem["dataColumn2"]
> > 
> > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > >
> > > I am trying to set the value of a column based on the value of another 
> > > column.  If I use ...selectedItem... it does not work, unless I am 
> > > mistaken.
> > > 
> > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > >
> > > > You access the value in a column of a datagrid like this...
> > > > 
> > > > yourDataGrid.selectedItem["dataColumnNameOfColumn"]
> > > > 
> > > > 
> > > > 
> > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > >
> > > > > I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds 
> > > > > to
> > > > > an ArrayCollection.  I need to change the value of one columen 
> > > > > (Profit)
> > > > > based on the value of another column (Kind) ie.. the results (either
> > > > > 'LONG' or SHORT').  Here is where I'm at.  I've tried putting code 
> > > > > into
> > > > > customer DataGridColumns and labelFunctions and ItemRenderers... but 
> > > > > can
> > > > > not do it.  What seem to be working most are events in the DataGrid
> > > > > Component, better than others, but comparing values in a DataGrid is
> > > > > obviously impossible.
> > > > > 
> > > > > Somehow I need the code to access ArrayCollection getItemat() but I
> > > > > can't do it!
> > > > > 
> > > > > Please help!
> > > > > 
> > > > > http://www.adobe.com/2006/mxml";
> > > > >  initialize="initTA()">
> > > > > 
> > > > >   > > > >  headerText="Kind"
> > > > >  dataField="Kind"
> > > > >  itemRenderer="com.steury.baseClasses.CellFieldTrd"/>
> > > > >   > > > >  headerText="Profit"/>
> > > > > 
> > > > >  
> > > > >  

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread postwick
if you just did dataGrid.selectedItem then that would be the selected row.  add 
["columnname"] to get to the column, so:

dataGrid.selectedItem["columnname"]

it's not the label, it's the data column name.

--- In flexcoders@yahoogroups.com, "Craig"  wrote:
>
> yes the datagrid is bound to an array collection.
> I don't want to select any item, I want to change the value of a column's 
> DataField to a one of two values based on the value of another column's 
> output.
> 
> I don't want to have to 'selecteditem' but I can try that code below are you 
> suggesting that I use it in the labelfunction of the datagrid column that I 
> am trying to change?
> 
> 
> --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> >
> > Is the datagrid bound to a collection?  if so, change the value in the 
> > collection.
> > 
> > or try...
> > 
> > yourDataGrid.selectedItem["dataColumn1"] = 
> > yourDataGrid.selectedItem["dataColumn2"]
> > 
> > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > >
> > > I am trying to set the value of a column based on the value of another 
> > > column.  If I use ...selectedItem... it does not work, unless I am 
> > > mistaken.
> > > 
> > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > >
> > > > You access the value in a column of a datagrid like this...
> > > > 
> > > > yourDataGrid.selectedItem["dataColumnNameOfColumn"]
> > > > 
> > > > 
> > > > 
> > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > >
> > > > > I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds 
> > > > > to
> > > > > an ArrayCollection.  I need to change the value of one columen 
> > > > > (Profit)
> > > > > based on the value of another column (Kind) ie.. the results (either
> > > > > 'LONG' or SHORT').  Here is where I'm at.  I've tried putting code 
> > > > > into
> > > > > customer DataGridColumns and labelFunctions and ItemRenderers... but 
> > > > > can
> > > > > not do it.  What seem to be working most are events in the DataGrid
> > > > > Component, better than others, but comparing values in a DataGrid is
> > > > > obviously impossible.
> > > > > 
> > > > > Somehow I need the code to access ArrayCollection getItemat() but I
> > > > > can't do it!
> > > > > 
> > > > > Please help!
> > > > > 
> > > > > http://www.adobe.com/2006/mxml";
> > > > >  initialize="initTA()">
> > > > > 
> > > > >   > > > >  headerText="Kind"
> > > > >  dataField="Kind"
> > > > >  itemRenderer="com.steury.baseClasses.CellFieldTrd"/>
> > > > >   > > > >  headerText="Profit"/>
> > > > > 
> > > > >  
> > > > >  

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread postwick
Is the datagrid bound to a collection?  if so, change the value in the 
collection.

or try...

yourDataGrid.selectedItem["dataColumn1"] = 
yourDataGrid.selectedItem["dataColumn2"]

--- In flexcoders@yahoogroups.com, "Craig"  wrote:
>
> I am trying to set the value of a column based on the value of another 
> column.  If I use ...selectedItem... it does not work, unless I am mistaken.
> 
> --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> >
> > You access the value in a column of a datagrid like this...
> > 
> > yourDataGrid.selectedItem["dataColumnNameOfColumn"]
> > 
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > >
> > > I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to
> > > an ArrayCollection.  I need to change the value of one columen (Profit)
> > > based on the value of another column (Kind) ie.. the results (either
> > > 'LONG' or SHORT').  Here is where I'm at.  I've tried putting code into
> > > customer DataGridColumns and labelFunctions and ItemRenderers... but can
> > > not do it.  What seem to be working most are events in the DataGrid
> > > Component, better than others, but comparing values in a DataGrid is
> > > obviously impossible.
> > > 
> > > Somehow I need the code to access ArrayCollection getItemat() but I
> > > can't do it!
> > > 
> > > Please help!
> > > 
> > > http://www.adobe.com/2006/mxml";
> > >  initialize="initTA()">
> > > 
> > >   > >  headerText="Kind"
> > >  dataField="Kind"
> > >  itemRenderer="com.steury.baseClasses.CellFieldTrd"/>
> > >   > >  headerText="Profit"/>
> > > 
> > >  
> > >  

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread Craig
yes the datagrid is bound to an array collection.
I don't want to select any item, I want to change the value of a column's 
DataField to a one of two values based on the value of another column's output.

I don't want to have to 'selecteditem' but I can try that code below are you 
suggesting that I use it in the labelfunction of the datagrid column that I am 
trying to change?


--- In flexcoders@yahoogroups.com, "postwick"  wrote:
>
> Is the datagrid bound to a collection?  if so, change the value in the 
> collection.
> 
> or try...
> 
> yourDataGrid.selectedItem["dataColumn1"] = 
> yourDataGrid.selectedItem["dataColumn2"]
> 
> --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> >
> > I am trying to set the value of a column based on the value of another 
> > column.  If I use ...selectedItem... it does not work, unless I am mistaken.
> > 
> > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > >
> > > You access the value in a column of a datagrid like this...
> > > 
> > > yourDataGrid.selectedItem["dataColumnNameOfColumn"]
> > > 
> > > 
> > > 
> > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > >
> > > > I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to
> > > > an ArrayCollection.  I need to change the value of one columen (Profit)
> > > > based on the value of another column (Kind) ie.. the results (either
> > > > 'LONG' or SHORT').  Here is where I'm at.  I've tried putting code into
> > > > customer DataGridColumns and labelFunctions and ItemRenderers... but can
> > > > not do it.  What seem to be working most are events in the DataGrid
> > > > Component, better than others, but comparing values in a DataGrid is
> > > > obviously impossible.
> > > > 
> > > > Somehow I need the code to access ArrayCollection getItemat() but I
> > > > can't do it!
> > > > 
> > > > Please help!
> > > > 
> > > > http://www.adobe.com/2006/mxml";
> > > >  initialize="initTA()">
> > > > 
> > > >   > > >  headerText="Kind"
> > > >  dataField="Kind"
> > > >  itemRenderer="com.steury.baseClasses.CellFieldTrd"/>
> > > >   > > >  headerText="Profit"/>
> > > > 
> > > >  
> > > >  

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread Craig
I am trying to set the value of a column based on the value of another column.  
If I use ...selectedItem... it does not work, unless I am mistaken.

--- In flexcoders@yahoogroups.com, "postwick"  wrote:
>
> You access the value in a column of a datagrid like this...
> 
> yourDataGrid.selectedItem["dataColumnNameOfColumn"]
> 
> 
> 
> --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> >
> > I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to
> > an ArrayCollection.  I need to change the value of one columen (Profit)
> > based on the value of another column (Kind) ie.. the results (either
> > 'LONG' or SHORT').  Here is where I'm at.  I've tried putting code into
> > customer DataGridColumns and labelFunctions and ItemRenderers... but can
> > not do it.  What seem to be working most are events in the DataGrid
> > Component, better than others, but comparing values in a DataGrid is
> > obviously impossible.
> > 
> > Somehow I need the code to access ArrayCollection getItemat() but I
> > can't do it!
> > 
> > Please help!
> > 
> > http://www.adobe.com/2006/mxml";
> >  initialize="initTA()">
> > 
> >   >  headerText="Kind"
> >  dataField="Kind"
> >  itemRenderer="com.steury.baseClasses.CellFieldTrd"/>
> >   >  headerText="Profit"/>
> > 
> >  
> >  

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread Craig
cause I was doing it within the custom component (column) itself for the 
datagrid, which can not hold an Id value, I can put it in the parent component 
however i'll give that a whack.


--- In flexcoders@yahoogroups.com, "postwick"  wrote:
>
> Not sure why you have all the Application.application stuff on there.  Just 
> reference the datagrid by it's id.
> 
> 
> 
> mygrid.selectedItem["columname"] = "some value"
> 
> --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> >
> > From within the custom component DataGrid Column I tried this code as you 
> > suggested at the initialize event but it errors:
> > 
> > 
> > if(Application.application.CnvPos.dgOrdExt.selectedItem["Kind"]=="LONG") 
> > Profit.dataField="Profit";
> > 
> > 
> > I don't think the selecteditem field is the answer.
> > 
> > 
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > >
> > > yes the datagrid is bound to an array collection.
> > > I don't want to select any item, I want to change the value of a column's 
> > > DataField to a one of two values based on the value of another column's 
> > > output.
> > > 
> > > I don't want to have to 'selecteditem' but I can try that code below are 
> > > you suggesting that I use it in the labelfunction of the datagrid column 
> > > that I am trying to change?
> > > 
> > > 
> > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > >
> > > > Is the datagrid bound to a collection?  if so, change the value in the 
> > > > collection.
> > > > 
> > > > or try...
> > > > 
> > > > yourDataGrid.selectedItem["dataColumn1"] = 
> > > > yourDataGrid.selectedItem["dataColumn2"]
> > > > 
> > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > >
> > > > > I am trying to set the value of a column based on the value of 
> > > > > another column.  If I use ...selectedItem... it does not work, unless 
> > > > > I am mistaken.
> > > > > 
> > > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > > >
> > > > > > You access the value in a column of a datagrid like this...
> > > > > > 
> > > > > > yourDataGrid.selectedItem["dataColumnNameOfColumn"]
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > > >
> > > > > > > I GIVE UP!! I have tried everything!!.. I have a dataGrid that 
> > > > > > > binds to
> > > > > > > an ArrayCollection.  I need to change the value of one columen 
> > > > > > > (Profit)
> > > > > > > based on the value of another column (Kind) ie.. the results 
> > > > > > > (either
> > > > > > > 'LONG' or SHORT').  Here is where I'm at.  I've tried putting 
> > > > > > > code into
> > > > > > > customer DataGridColumns and labelFunctions and ItemRenderers... 
> > > > > > > but can
> > > > > > > not do it.  What seem to be working most are events in the 
> > > > > > > DataGrid
> > > > > > > Component, better than others, but comparing values in a DataGrid 
> > > > > > > is
> > > > > > > obviously impossible.
> > > > > > > 
> > > > > > > Somehow I need the code to access ArrayCollection getItemat() but 
> > > > > > > I
> > > > > > > can't do it!
> > > > > > > 
> > > > > > > Please help!
> > > > > > > 
> > > > > > > http://www.adobe.com/2006/mxml";
> > > > > > >  initialize="initTA()">
> > > > > > > 
> > > > > > >   > > > > > >  headerText="Kind"
> > > > > > >  dataField="Kind"
> > > > > > >  
> > > > > > > itemRenderer="com.steury.baseClasses.CellFieldTrd"/>
> > > > > > >   > > > > > >  headerText="Profit"/>
> > > > > > > 
> > > > > > >  
> > > > > > >  

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread Craig
so if it's doing it row by row, then it would need to be a labelfunction event 
right?  where would you suggest the code go?  there needs to be an 
if (datagrid.seleteditem["Kind]=="LONG")datagrid.selecteditem[Profit]="Profit";
then another line that stipulate the other option:
if 
(datagrid.selecteditem[Kind]=="Short")datagrid.selecteditem[Profit]="ShProfit";

--- In flexcoders@yahoogroups.com, "postwick"  wrote:
>
> if you just did dataGrid.selectedItem then that would be the selected row.  
> add ["columnname"] to get to the column, so:
> 
> dataGrid.selectedItem["columnname"]
> 
> it's not the label, it's the data column name.
> 
> --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> >
> > yes the datagrid is bound to an array collection.
> > I don't want to select any item, I want to change the value of a column's 
> > DataField to a one of two values based on the value of another column's 
> > output.
> > 
> > I don't want to have to 'selecteditem' but I can try that code below are 
> > you suggesting that I use it in the labelfunction of the datagrid column 
> > that I am trying to change?
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > >
> > > Is the datagrid bound to a collection?  if so, change the value in the 
> > > collection.
> > > 
> > > or try...
> > > 
> > > yourDataGrid.selectedItem["dataColumn1"] = 
> > > yourDataGrid.selectedItem["dataColumn2"]
> > > 
> > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > >
> > > > I am trying to set the value of a column based on the value of another 
> > > > column.  If I use ...selectedItem... it does not work, unless I am 
> > > > mistaken.
> > > > 
> > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > >
> > > > > You access the value in a column of a datagrid like this...
> > > > > 
> > > > > yourDataGrid.selectedItem["dataColumnNameOfColumn"]
> > > > > 
> > > > > 
> > > > > 
> > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > >
> > > > > > I GIVE UP!! I have tried everything!!.. I have a dataGrid that 
> > > > > > binds to
> > > > > > an ArrayCollection.  I need to change the value of one columen 
> > > > > > (Profit)
> > > > > > based on the value of another column (Kind) ie.. the results (either
> > > > > > 'LONG' or SHORT').  Here is where I'm at.  I've tried putting code 
> > > > > > into
> > > > > > customer DataGridColumns and labelFunctions and ItemRenderers... 
> > > > > > but can
> > > > > > not do it.  What seem to be working most are events in the DataGrid
> > > > > > Component, better than others, but comparing values in a DataGrid is
> > > > > > obviously impossible.
> > > > > > 
> > > > > > Somehow I need the code to access ArrayCollection getItemat() but I
> > > > > > can't do it!
> > > > > > 
> > > > > > Please help!
> > > > > > 
> > > > > > http://www.adobe.com/2006/mxml";
> > > > > >  initialize="initTA()">
> > > > > > 
> > > > > >   > > > > >  headerText="Kind"
> > > > > >  dataField="Kind"
> > > > > >  
> > > > > > itemRenderer="com.steury.baseClasses.CellFieldTrd"/>
> > > > > >   > > > > >  headerText="Profit"/>
> > > > > > 
> > > > > >  
> > > > > >  

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread postwick
Not sure why you have all the Application.application stuff on there.  Just 
reference the datagrid by it's id.



mygrid.selectedItem["columname"] = "some value"

--- In flexcoders@yahoogroups.com, "Craig"  wrote:
>
> From within the custom component DataGrid Column I tried this code as you 
> suggested at the initialize event but it errors:
> 
>   
> if(Application.application.CnvPos.dgOrdExt.selectedItem["Kind"]=="LONG") 
> Profit.dataField="Profit";
> 
> 
> I don't think the selecteditem field is the answer.
> 
> 
> 
> 
> --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> >
> > yes the datagrid is bound to an array collection.
> > I don't want to select any item, I want to change the value of a column's 
> > DataField to a one of two values based on the value of another column's 
> > output.
> > 
> > I don't want to have to 'selecteditem' but I can try that code below are 
> > you suggesting that I use it in the labelfunction of the datagrid column 
> > that I am trying to change?
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > >
> > > Is the datagrid bound to a collection?  if so, change the value in the 
> > > collection.
> > > 
> > > or try...
> > > 
> > > yourDataGrid.selectedItem["dataColumn1"] = 
> > > yourDataGrid.selectedItem["dataColumn2"]
> > > 
> > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > >
> > > > I am trying to set the value of a column based on the value of another 
> > > > column.  If I use ...selectedItem... it does not work, unless I am 
> > > > mistaken.
> > > > 
> > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > >
> > > > > You access the value in a column of a datagrid like this...
> > > > > 
> > > > > yourDataGrid.selectedItem["dataColumnNameOfColumn"]
> > > > > 
> > > > > 
> > > > > 
> > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > >
> > > > > > I GIVE UP!! I have tried everything!!.. I have a dataGrid that 
> > > > > > binds to
> > > > > > an ArrayCollection.  I need to change the value of one columen 
> > > > > > (Profit)
> > > > > > based on the value of another column (Kind) ie.. the results (either
> > > > > > 'LONG' or SHORT').  Here is where I'm at.  I've tried putting code 
> > > > > > into
> > > > > > customer DataGridColumns and labelFunctions and ItemRenderers... 
> > > > > > but can
> > > > > > not do it.  What seem to be working most are events in the DataGrid
> > > > > > Component, better than others, but comparing values in a DataGrid is
> > > > > > obviously impossible.
> > > > > > 
> > > > > > Somehow I need the code to access ArrayCollection getItemat() but I
> > > > > > can't do it!
> > > > > > 
> > > > > > Please help!
> > > > > > 
> > > > > > http://www.adobe.com/2006/mxml";
> > > > > >  initialize="initTA()">
> > > > > > 
> > > > > >   > > > > >  headerText="Kind"
> > > > > >  dataField="Kind"
> > > > > >  
> > > > > > itemRenderer="com.steury.baseClasses.CellFieldTrd"/>
> > > > > >   > > > > >  headerText="Profit"/>
> > > > > > 
> > > > > >  
> > > > > >  

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread postwick
Is there a particular row you want to update?  If a row is selected, you would 
use...

Profit.selectedItem["datafieldname"]


--- In flexcoders@yahoogroups.com, "Craig"  wrote:
>
> From within the custom component DataGrid Column I tried this code as you 
> suggested at the initialize event but it errors:
> 
>   
> if(Application.application.CnvPos.dgOrdExt.selectedItem["Kind"]=="LONG") 
> Profit.dataField="Profit";
> 
> 
> I don't think the selecteditem field is the answer.
> 
> 
> 
> 
> --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> >
> > yes the datagrid is bound to an array collection.
> > I don't want to select any item, I want to change the value of a column's 
> > DataField to a one of two values based on the value of another column's 
> > output.
> > 
> > I don't want to have to 'selecteditem' but I can try that code below are 
> > you suggesting that I use it in the labelfunction of the datagrid column 
> > that I am trying to change?
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > >
> > > Is the datagrid bound to a collection?  if so, change the value in the 
> > > collection.
> > > 
> > > or try...
> > > 
> > > yourDataGrid.selectedItem["dataColumn1"] = 
> > > yourDataGrid.selectedItem["dataColumn2"]
> > > 
> > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > >
> > > > I am trying to set the value of a column based on the value of another 
> > > > column.  If I use ...selectedItem... it does not work, unless I am 
> > > > mistaken.
> > > > 
> > > > --- In flexcoders@yahoogroups.com, "postwick"  wrote:
> > > > >
> > > > > You access the value in a column of a datagrid like this...
> > > > > 
> > > > > yourDataGrid.selectedItem["dataColumnNameOfColumn"]
> > > > > 
> > > > > 
> > > > > 
> > > > > --- In flexcoders@yahoogroups.com, "Craig"  wrote:
> > > > > >
> > > > > > I GIVE UP!! I have tried everything!!.. I have a dataGrid that 
> > > > > > binds to
> > > > > > an ArrayCollection.  I need to change the value of one columen 
> > > > > > (Profit)
> > > > > > based on the value of another column (Kind) ie.. the results (either
> > > > > > 'LONG' or SHORT').  Here is where I'm at.  I've tried putting code 
> > > > > > into
> > > > > > customer DataGridColumns and labelFunctions and ItemRenderers... 
> > > > > > but can
> > > > > > not do it.  What seem to be working most are events in the DataGrid
> > > > > > Component, better than others, but comparing values in a DataGrid is
> > > > > > obviously impossible.
> > > > > > 
> > > > > > Somehow I need the code to access ArrayCollection getItemat() but I
> > > > > > can't do it!
> > > > > > 
> > > > > > Please help!
> > > > > > 
> > > > > > http://www.adobe.com/2006/mxml";
> > > > > >  initialize="initTA()">
> > > > > > 
> > > > > >   > > > > >  headerText="Kind"
> > > > > >  dataField="Kind"
> > > > > >  
> > > > > > itemRenderer="com.steury.baseClasses.CellFieldTrd"/>
> > > > > >   > > > > >  headerText="Profit"/>
> > > > > > 
> > > > > >  
> > > > > >  

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread postwick
You access the value in a column of a datagrid like this...

yourDataGrid.selectedItem["dataColumnNameOfColumn"]



--- In flexcoders@yahoogroups.com, "Craig"  wrote:
>
> I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to
> an ArrayCollection.  I need to change the value of one columen (Profit)
> based on the value of another column (Kind) ie.. the results (either
> 'LONG' or SHORT').  Here is where I'm at.  I've tried putting code into
> customer DataGridColumns and labelFunctions and ItemRenderers... but can
> not do it.  What seem to be working most are events in the DataGrid
> Component, better than others, but comparing values in a DataGrid is
> obviously impossible.
> 
> Somehow I need the code to access ArrayCollection getItemat() but I
> can't do it!
> 
> Please help!
> 
> http://www.adobe.com/2006/mxml";
>  initialize="initTA()">
> 
>headerText="Kind"
>  dataField="Kind"
>  itemRenderer="com.steury.baseClasses.CellFieldTrd"/>
>headerText="Profit"/>
> 
>  
>  

[flexcoders] Re: This is not as easy as it seems ... apparently...

2009-07-12 Thread Craig
I GIVE UP!! I have tried everything!!.. I have a dataGrid that binds to
an ArrayCollection.  I need to change the value of one columen (Profit)
based on the value of another column (Kind) ie.. the results (either
'LONG' or SHORT').  Here is where I'm at.  I've tried putting code into
customer DataGridColumns and labelFunctions and ItemRenderers... but can
not do it.  What seem to be working most are events in the DataGrid
Component, better than others, but comparing values in a DataGrid is
obviously impossible.

Somehow I need the code to access ArrayCollection getItemat() but I
can't do it!

Please help!

http://www.adobe.com/2006/mxml";
 initialize="initTA()">