[flexcoders] Re: ComboBox itemEditor example inside of DataGrid??

2006-10-16 Thread Michael Labriola
Mike,

I apologize in advance if this is now what you are asking, but, have
you looked at the editorDataField property?

If this isn't what you are looking for, I can post an example of a
ComboBox renderer in a DataGrid.

--Mike


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

 Hello All,
 
 I am WAY beyond frustrated at the moment, and am ready to throw this
 computer out the window right now.
 
 I've been able to get this to work in the most simple of examples - BUT,
 here is what I need to do that may be considered unique in my case
 (although, not at all uncommon in most other typical programming
 environments).
 
 In my case, my OrderDetails DataGrid contains a 'ProductID' Field from
 the 'Products' Table.  It would be redundant to create an additional
 field called ProductName within my OrderDetails Table - since it
 already exists in my Products Table.
 
 I know for a fact, that there is a way for the ComboBox itemEditor, to
 display the Label property of the Product (in this case, ProductName),
 but still leave intact, the Numeric Data property of the Product (in
 this case, ProductID) - so that part gets written back to the DataBase.
 
 I am having a TERRIBLE time, finding an example of how to have the
 ComboBox display one thing, but set the value in the DataGrid, to some
 OTHER thing - 
 
 Could any of you help me in this regard?
 
 Thanks in advance,
 
 Mike







--
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/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

* 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/
 



RE: [flexcoders] Re: ComboBox itemEditor example inside of DataGrid??

2006-10-16 Thread Mike Anderson
Yes, I've been exploring that property all day long -

There must be something else I am doing wrong here -

So with that said, YES, if you could please post an example, I'd be
grateful -

Right now, I have a ComboBox Component I created - and I am binding the
dataProvider property of it, to my Apps model.produstList property.
And yes, this is a Cairngorm based application - but I don't think this
should affect anything.

My OrderDetails DataGrid, is populated using ValueObjects - and the
ProductID Column initially displays only numbers.  Of course, this is
great - since that column should only display Integer values anyway
(this is previous to applying the itemRenderer and itemEditor).

BUT, now that I want the ProductName value to display all the time, do
I also need to declare an itemRenderer as well?  I ask this because,
only the ComboBox populated with ProductID and ProductName, contains the
associated information - where the underlying ProductID value contained
behind the scenes, drives what is displayed to the user.  The issue is
though, the itemEditor only becomes active, whenever the Cell is active
correct?

Well, bottom line is, I am so frazzled by this incident, that I am sick
and tired of racking my brain trying to figure this out.  I wasted 2
incredibly valuable days on this darn problem, with absolutely nothing
to show for it.

If you could please post some code and examples, I would be grateful.

Thanks in advance,

Mike

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Michael Labriola
Sent: Monday, October 16, 2006 3:13 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: ComboBox itemEditor example inside of
DataGrid??

Mike,

I apologize in advance if this is now what you are asking, but, have you
looked at the editorDataField property?

If this isn't what you are looking for, I can post an example of a
ComboBox renderer in a DataGrid.

--Mike


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

 Hello All,
 
 I am WAY beyond frustrated at the moment, and am ready to throw this 
 computer out the window right now.
 
 I've been able to get this to work in the most simple of examples - 
 BUT, here is what I need to do that may be considered unique in my 
 case (although, not at all uncommon in most other typical programming 
 environments).
 
 In my case, my OrderDetails DataGrid contains a 'ProductID' Field from

 the 'Products' Table.  It would be redundant to create an additional 
 field called ProductName within my OrderDetails Table - since it 
 already exists in my Products Table.
 
 I know for a fact, that there is a way for the ComboBox itemEditor, to

 display the Label property of the Product (in this case, 
 ProductName), but still leave intact, the Numeric Data property of 
 the Product (in this case, ProductID) - so that part gets written back
to the DataBase.
 
 I am having a TERRIBLE time, finding an example of how to have the 
 ComboBox display one thing, but set the value in the DataGrid, to some

 OTHER thing -
 
 Could any of you help me in this regard?
 
 Thanks in advance,
 
 Mike







--
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






--
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/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

* 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/
 



[flexcoders] Re: ComboBox itemEditor example inside of DataGrid??

2006-10-16 Thread Michael Labriola

Mike,

Take a look at this and see if it clears things up. Sorry for the long
code post... 

mx:Model id=myModel
  products
product
  ProductID1/ProductID
  ProductCategory3/ProductCategory
  ProductNameBob/ProductName
  ProductDescriptionIts Bob/ProductDescription
/product
product
  ProductID2/ProductID
  ProductCategory2/ProductCategory
  ProductNameGary/ProductName
  ProductDescriptionIts Gary/ProductDescription
/product
  /products
/mx:Model

mx:Model id=myCats
  categories
category
  CategoryID2/CategoryID
  CategoryNameNot the name of the ID/CategoryName
/category
category
  CategoryID3/CategoryID
  CategoryNamereally, not an ID/CategoryName
/category
  /categories
/mx:Model

mx:Script
  ![CDATA[
import mx.controls.ComboBox;
import mx.controls.dataGridClasses.DataGridColumn;

protected function displayProductCategoryName( row:Object,
column:DataGridColumn ):String {
  //Do anything you would like here, but, at the end of the day,
return a String
  var categoryName:String = ;

  //There exist better ways to do this part
  for ( var i:Number=0; imyCats.category.length; i++ ) {
if ( row[ column.dataField ] == myCats.category[i].CategoryID ) {
  categoryName = myCats.category[i].CategoryName;
  break;
}
  }

  return categoryName;
}
  ]]
/mx:Script

mx:DataGrid id=grid dataProvider={myModel.product} editable=true
  mx:columns
mx:DataGridColumn dataField=ProductName/
mx:DataGridColumn dataField=ProductCategory
editorDataField=selectedCategoryID
labelFunction=displayProductCategoryName
mx:itemEditor
mx:Component
mx:ComboBox
dataProvider={outerDocument.myCats.category} labelField=CategoryName
mx:Script
  ![CDATA[
public function get selectedCategoryID():String {
  return selectedItem.CategoryID;
}
  ]]
/mx:Script
  /mx:ComboBox
/mx:Component
/mx:itemEditor
/mx:DataGridColumn
mx:DataGridColumn dataField=ProductDescription/
  /mx:columns
/mx:DataGrid


--Mike

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

 Yes, I've been exploring that property all day long -
 
 There must be something else I am doing wrong here -
 
 So with that said, YES, if you could please post an example, I'd be
 grateful -
 
 Right now, I have a ComboBox Component I created - and I am binding the
 dataProvider property of it, to my Apps model.produstList property.
 And yes, this is a Cairngorm based application - but I don't think this
 should affect anything.
 
 My OrderDetails DataGrid, is populated using ValueObjects - and the
 ProductID Column initially displays only numbers.  Of course, this is
 great - since that column should only display Integer values anyway
 (this is previous to applying the itemRenderer and itemEditor).
 
 BUT, now that I want the ProductName value to display all the time, do
 I also need to declare an itemRenderer as well?  I ask this because,
 only the ComboBox populated with ProductID and ProductName, contains the
 associated information - where the underlying ProductID value contained
 behind the scenes, drives what is displayed to the user.  The issue is
 though, the itemEditor only becomes active, whenever the Cell is active
 correct?
 
 Well, bottom line is, I am so frazzled by this incident, that I am sick
 and tired of racking my brain trying to figure this out.  I wasted 2
 incredibly valuable days on this darn problem, with absolutely nothing
 to show for it.
 
 If you could please post some code and examples, I would be grateful.
 
 Thanks in advance,
 
 Mike
 
 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Michael Labriola
 Sent: Monday, October 16, 2006 3:13 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: ComboBox itemEditor example inside of
 DataGrid??
 
 Mike,
 
 I apologize in advance if this is now what you are asking, but, have you
 looked at the editorDataField property?
 
 If this isn't what you are looking for, I can post an example of a
 ComboBox renderer in a DataGrid.
 
 --Mike
 
 
 --- In flexcoders@yahoogroups.com, Mike Anderson mike@ wrote:
 
  Hello All,
  
  I am WAY beyond frustrated at the moment, and am ready to throw this 
  computer out the window right now.
  
  I've been able to get this to work in the most simple of examples - 
  BUT, here is what I need to do that may be considered unique in my 
  case (although, not at all uncommon in most other typical programming 
  environments).
  
  In my case, my OrderDetails DataGrid contains a 'ProductID' Field from
 
  the 'Products' Table.  It would be redundant to create an additional 
  field called ProductName within my OrderDetails Table - since

RE: [flexcoders] Re: ComboBox itemEditor example inside of DataGrid??

2006-10-16 Thread Mike Anderson
Thank You Michael!!

It really didn't hit me, to oversimplify my original design like that...

Since I am a pretty experienced programmer, I immediately jumped into
the more advanced methods of performing this type of task -

I had written custom classes, one for the itemRenderer and one for the
itemEditor - and I had lots of code/listeners setup to react to the
proper events.  Specifically, the DataGrid_ItemEditEnd event - which is
used extensively for this type of thing.

My guess, is that I got things so over complicated, that I was unable to
track down what the true problem was.

I will use your example though, and then re-write all my Classes, so it
performs the exact same functions.  Hopefully, I will then get it to
work MY way.

There is absolutely nothing wrong with your methods - in fact, I
wouldn't have been able to figure it out without your help - BUT, I
write code in a very specific way, and I LOVE writing Packages and
Classes - it keeps things so nice and tight - not to mention, the
reusability factor...

Well, thanks again - I truly appreciate your help on this :)

Mike 

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Michael Labriola
Sent: Monday, October 16, 2006 4:47 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: ComboBox itemEditor example inside of
DataGrid??


Mike,

Take a look at this and see if it clears things up. Sorry for the long
code post... 

mx:Model id=myModel
  products
product
  ProductID1/ProductID
  ProductCategory3/ProductCategory
  ProductNameBob/ProductName
  ProductDescriptionIts Bob/ProductDescription
/product
product
  ProductID2/ProductID
  ProductCategory2/ProductCategory
  ProductNameGary/ProductName
  ProductDescriptionIts Gary/ProductDescription
/product
  /products
/mx:Model

mx:Model id=myCats
  categories
category
  CategoryID2/CategoryID
  CategoryNameNot the name of the ID/CategoryName
/category
category
  CategoryID3/CategoryID
  CategoryNamereally, not an ID/CategoryName
/category
  /categories
/mx:Model

mx:Script
  ![CDATA[
import mx.controls.ComboBox;
import mx.controls.dataGridClasses.DataGridColumn;

protected function displayProductCategoryName( row:Object,
column:DataGridColumn ):String {
  //Do anything you would like here, but, at the end of the day,
return a String
  var categoryName:String = ;

  //There exist better ways to do this part
  for ( var i:Number=0; imyCats.category.length; i++ ) {
if ( row[ column.dataField ] == myCats.category[i].CategoryID )
{
  categoryName = myCats.category[i].CategoryName;
  break;
}
  }

  return categoryName;
}
  ]]
/mx:Script

mx:DataGrid id=grid dataProvider={myModel.product} editable=true
  mx:columns
mx:DataGridColumn dataField=ProductName/
mx:DataGridColumn dataField=ProductCategory
editorDataField=selectedCategoryID
labelFunction=displayProductCategoryName
mx:itemEditor
mx:Component
mx:ComboBox
dataProvider={outerDocument.myCats.category}
labelField=CategoryName
mx:Script
  ![CDATA[
public function get selectedCategoryID():String {
  return selectedItem.CategoryID;
}
  ]]
/mx:Script
  /mx:ComboBox
/mx:Component
/mx:itemEditor
/mx:DataGridColumn
mx:DataGridColumn dataField=ProductDescription/
  /mx:columns
/mx:DataGrid


--Mike

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

 Yes, I've been exploring that property all day long -
 
 There must be something else I am doing wrong here -
 
 So with that said, YES, if you could please post an example, I'd be 
 grateful -
 
 Right now, I have a ComboBox Component I created - and I am binding 
 the dataProvider property of it, to my Apps model.produstList
property.
 And yes, this is a Cairngorm based application - but I don't think 
 this should affect anything.
 
 My OrderDetails DataGrid, is populated using ValueObjects - and the 
 ProductID Column initially displays only numbers.  Of course, this is 
 great - since that column should only display Integer values anyway 
 (this is previous to applying the itemRenderer and itemEditor).
 
 BUT, now that I want the ProductName value to display all the time, 
 do I also need to declare an itemRenderer as well?  I ask this 
 because, only the ComboBox populated with ProductID and ProductName, 
 contains the associated information - where the underlying ProductID 
 value contained behind the scenes, drives what is displayed to the 
 user.  The issue is though, the itemEditor only becomes active, 
 whenever the Cell is active correct?
 
 Well, bottom line is, I am so frazzled by this incident, that I am 
 sick and tired of racking my brain trying

[flexcoders] Re: ComboBox itemEditor example inside of DataGrid??

2006-10-16 Thread Michael Labriola

Mike,

A custom class is the right way. It is just a lot harder to post.

Best luck,
Mike

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

 Thank You Michael!!
 
 It really didn't hit me, to oversimplify my original design like that...
 
 Since I am a pretty experienced programmer, I immediately jumped into
 the more advanced methods of performing this type of task -
 
 I had written custom classes, one for the itemRenderer and one for the
 itemEditor - and I had lots of code/listeners setup to react to the
 proper events.  Specifically, the DataGrid_ItemEditEnd event - which is
 used extensively for this type of thing.
 
 My guess, is that I got things so over complicated, that I was unable to
 track down what the true problem was.
 
 I will use your example though, and then re-write all my Classes, so it
 performs the exact same functions.  Hopefully, I will then get it to
 work MY way.
 
 There is absolutely nothing wrong with your methods - in fact, I
 wouldn't have been able to figure it out without your help - BUT, I
 write code in a very specific way, and I LOVE writing Packages and
 Classes - it keeps things so nice and tight - not to mention, the
 reusability factor...
 
 Well, thanks again - I truly appreciate your help on this :)
 
 Mike 
 
 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Michael Labriola
 Sent: Monday, October 16, 2006 4:47 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: ComboBox itemEditor example inside of
 DataGrid??
 
 
 Mike,
 
 Take a look at this and see if it clears things up. Sorry for the long
 code post... 
 
 mx:Model id=myModel
   products
 product
   ProductID1/ProductID
   ProductCategory3/ProductCategory
   ProductNameBob/ProductName
   ProductDescriptionIts Bob/ProductDescription
 /product
 product
   ProductID2/ProductID
   ProductCategory2/ProductCategory
   ProductNameGary/ProductName
   ProductDescriptionIts Gary/ProductDescription
 /product
   /products
 /mx:Model
 
 mx:Model id=myCats
   categories
 category
   CategoryID2/CategoryID
   CategoryNameNot the name of the ID/CategoryName
 /category
 category
   CategoryID3/CategoryID
   CategoryNamereally, not an ID/CategoryName
 /category
   /categories
 /mx:Model
 
 mx:Script
   ![CDATA[
 import mx.controls.ComboBox;
 import mx.controls.dataGridClasses.DataGridColumn;
 
 protected function displayProductCategoryName( row:Object,
 column:DataGridColumn ):String {
   //Do anything you would like here, but, at the end of the day,
 return a String
   var categoryName:String = ;
 
   //There exist better ways to do this part
   for ( var i:Number=0; imyCats.category.length; i++ ) {
 if ( row[ column.dataField ] == myCats.category[i].CategoryID )
 {
   categoryName = myCats.category[i].CategoryName;
   break;
 }
   }
 
   return categoryName;
 }
   ]]
 /mx:Script
 
 mx:DataGrid id=grid dataProvider={myModel.product} editable=true
   mx:columns
 mx:DataGridColumn dataField=ProductName/
 mx:DataGridColumn dataField=ProductCategory
 editorDataField=selectedCategoryID
 labelFunction=displayProductCategoryName
 mx:itemEditor
 mx:Component
 mx:ComboBox
 dataProvider={outerDocument.myCats.category}
 labelField=CategoryName
 mx:Script
   ![CDATA[
 public function get selectedCategoryID():String {
   return selectedItem.CategoryID;
 }
   ]]
 /mx:Script
   /mx:ComboBox
 /mx:Component
 /mx:itemEditor
 /mx:DataGridColumn
 mx:DataGridColumn dataField=ProductDescription/
   /mx:columns
 /mx:DataGrid
 
 
 --Mike
 
 --- In flexcoders@yahoogroups.com, Mike Anderson mike@ wrote:
 
  Yes, I've been exploring that property all day long -
  
  There must be something else I am doing wrong here -
  
  So with that said, YES, if you could please post an example, I'd be 
  grateful -
  
  Right now, I have a ComboBox Component I created - and I am binding 
  the dataProvider property of it, to my Apps model.produstList
 property.
  And yes, this is a Cairngorm based application - but I don't think 
  this should affect anything.
  
  My OrderDetails DataGrid, is populated using ValueObjects - and the 
  ProductID Column initially displays only numbers.  Of course, this is 
  great - since that column should only display Integer values anyway 
  (this is previous to applying the itemRenderer and itemEditor).
  
  BUT, now that I want the ProductName value to display all the time, 
  do I also need to declare an itemRenderer as well?  I ask this 
  because, only the ComboBox populated with ProductID and ProductName, 
  contains the associated information - where