RE: [flexcoders] Re: databinding issue for combobox

2006-03-30 Thread Tracy Spratt










You could either do it manually, similar
to the second example I posted, or use the copyObject class built by several of
the folks on this list. It does deep copy and preserves types.

 

Tracy

 

  
/*

  returns a deep copy of an object  

   */ 

   private var copyDepthLevel:Number = 0;

   private var copyCache = new Array();    

  public function copyObject(source):Object

  {

    var cl:Number = copyCache.length;

    for (var i:Number = 0; i < cl;
i++)  {

  var o = copyCache[i];

  if (o.s == source)

    return o.t;

    }

 

    copyDepthLevel++;

    var newObj;

 

    if (typeof(source.__constructor__) ==
"function") {

  // for AS2 classes

  newObj = new
source.__constructor__();

    }

    else if (typeof(source.constructor) ==
"function") {

  // for Arrays and Objects

  newObj = new source.constructor();

    }

    else {

  // for goodness sake, instantiate
*something*!

  newObj = new Object();

    }

 

    copyCache.push({s: source, t:
newObj});

 

    for (var p in source) {

  var v = source[p];

  newObj[p] = typeof v ==
"object" ? copyObject(v) : v;

    }

 

    if (--copyDepthLevel == 0)  {

  copyCache = [];

     }

 

    return newObj;

  }//copyObject   

 

 









From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Stefan Richter
Sent: Thursday, March 30, 2006
2:57 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re:
databinding issue for combobox



 

Good point.

Any idea how that's best approached - is
there a built-in class that can handle this?

 

Stefan

 

 



 







From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Tracy
 Spratt
Sent: 30 March 2006 18:55
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re:
databinding issue for combobox

It occurs to me that  dgDP.addItem(cboSource.selectedItem) is adding a reference to
the object in the combobox dataProvider, not a new object.

 

This might be the problem.

 

Probably we should use some objectCopy
function to create a new object.

 

Tracy

 









From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Stefan Richter
Sent: Thursday, March 30, 2006
4:30 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re:
databinding issue for combobox



 

Sorry to hijack this thread.

 

Thanks for the example Tracy. I have somewhat changed it for Flex2
and run into a small issue. I am using 2 ArrayCollections, one for the combobox
and one for the datagrid:

 

  [Bindable]
  public  var cbDP:ArrayCollection;
  [Bindable]
  public  var dgDP:ArrayCollection;
  
  public function initData():void
  {
   cbDP = new ArrayCollection(
[ {label:"A", Number:0},
{label:"B", Number:1}, {label:"C", Number:2}]
   );
   dgDP = new ArrayCollection();
  }

 

I then 'shift' one item from the combobox
to the datagrid:

 



  private function addRow():void
  {
   dgDP.addItem(cboSource.selectedItem); // cboSource is the
actual component on stage
  }





 





This works fine. But when I add the same
item multiple times to the datagrid then only ther last added item out of the
group of same items is selectable in the datagrid. This must be an easy one to
fix but I am not sure what is going wrong.





 





I noticed that the mx_internal_uid is the
same for all 'same' items in the grid.





 





Any help appreciated.





 





Stefan





 





 



 

 

















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



   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.



  











RE: [flexcoders] Re: databinding issue for combobox

2006-03-30 Thread Stefan Richter





Good point.
Any idea how that's best approached - is there a built-in 
class that can handle this?
 
Stefan
 
 

  
  
  From: flexcoders@yahoogroups.com 
  [mailto:[EMAIL PROTECTED] On Behalf Of Tracy 
  SprattSent: 30 March 2006 18:55To: 
  flexcoders@yahoogroups.comSubject: RE: [flexcoders] Re: databinding 
  issue for combobox
  
  
  It occurs to me that 
   dgDP.addItem(cboSource.selectedItem) 
  is adding a reference to the object in the combobox dataProvider, not a new 
  object.
   
  This might be the 
  problem.
   
  Probably we should 
  use some objectCopy function to create a new 
  object.
   
  Tracy
   
  
  
  
  
  From: 
  flexcoders@yahoogroups.com 
  [mailto:flexcoders@yahoogroups.com] 
  On Behalf Of Stefan 
  RichterSent: Thursday, March 
  30, 2006 4:30 AMTo: 
  flexcoders@yahoogroups.comSubject: RE: [flexcoders] Re: databinding 
  issue for combobox
   
  Sorry to hijack this 
  thread.
   
  Thanks for the 
  example Tracy. 
  I have somewhat changed it for Flex2 and run into a small issue. I am using 2 
  ArrayCollections, one for the combobox and one for the 
  datagrid:
   
    [Bindable]  public  
  var 
  cbDP:ArrayCollection;  [Bindable]  public  
  var dgDP:ArrayCollection;public function 
  initData():void  {   cbDP = new 
  ArrayCollection([ {label:"A", Number:0}, 
  {label:"B", Number:1}, {label:"C", 
  Number:2}]   );   dgDP = new 
  ArrayCollection();  }
   
  I then 'shift' one 
  item from the combobox to the datagrid:
   
  
    private 
  function 
  addRow():void  {   dgDP.addItem(cboSource.selectedItem); 
  // cboSource is the actual component on 
  stage  }
  
   
  
  This works fine. But 
  when I add the same item multiple times to the datagrid then only ther last 
  added item out of the group of same items is selectable in the datagrid. This 
  must be an easy one to fix but I am not sure what is going 
  wrong.
  
   
  
  I noticed that the 
  mx_internal_uid is the same for all 'same' items in the 
  grid.
  
   
  
  Any help 
  appreciated.
  
   
  
  Stefan
  
   
  
   
   
   
  





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



   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.



  









RE: [flexcoders] Re: databinding issue for combobox

2006-03-30 Thread Tracy Spratt










It occurs to me that  dgDP.addItem(cboSource.selectedItem) is adding a reference to
the object in the combobox dataProvider, not a new object.

 

This might be the problem.

 

Probably we should use some objectCopy
function to create a new object.

 

Tracy

 









From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Stefan Richter
Sent: Thursday, March 30, 2006
4:30 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re:
databinding issue for combobox



 

Sorry to hijack this thread.

 

Thanks for the example Tracy. I have somewhat changed it for Flex2
and run into a small issue. I am using 2 ArrayCollections, one for the combobox
and one for the datagrid:

 

  [Bindable]
  public  var cbDP:ArrayCollection;
  [Bindable]
  public  var dgDP:ArrayCollection;
  
  public function initData():void
  {
   cbDP = new ArrayCollection(
[ {label:"A", Number:0},
{label:"B", Number:1}, {label:"C", Number:2}]
   );
   dgDP = new ArrayCollection();
  }

 

I then 'shift' one item from the combobox
to the datagrid:

 



  private function addRow():void
  {
   dgDP.addItem(cboSource.selectedItem); // cboSource is the
actual component on stage
  }





 





This works fine. But when I add the same
item multiple times to the datagrid then only ther last added item out of the
group of same items is selectable in the datagrid. This must be an easy one to
fix but I am not sure what is going wrong.





 





I noticed that the mx_internal_uid is the
same for all 'same' items in the grid.





 





Any help appreciated.





 





Stefan





 





 



 

 









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



   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.



  











[flexcoders] Re: databinding issue for combobox

2006-03-30 Thread rgwilson26
Tracy,

Thanks for taking the time to do the example. I got it working just 
fine. That makes it a lot more clear now that I see how it 
works...much appreciated.

Ryan


--- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> And here is an enhanced example that has both the same structure and
> different structures.
> Tracy
> 
> http://www.macromedia.com/2003/mxml"; 
>   initialize="initApp()"
>horizontalAlign="left">
> 
> 
> 
>   
>   
>click="addRow()"/>
>   
>  
> 
> columnName="label" />
> columnName="Number" />
>
> 
>  
> 
> 
> 
>   
>/>
>click="addRow2()"/>
>   
>  
> 
> columnName="someOtherlabel" />
> columnName="someOtherNumber" />
>
> 
>  
> 
> 
> 
> 
> -Original Message-
> From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
> Behalf Of Tracy Spratt
> Sent: Wednesday, March 29, 2006 8:32 PM
> To: flexcoders@yahoogroups.com
> Subject: RE: [flexcoders] Re: databinding issue for combobox
> 
> Here is a sample app that migh approach what you want.  It assumes 
the
> item object structures are the same for both controls.
> 
> Tracy
> 
> 
> http://www.macromedia.com/2003/mxml"; 
>horizontalAlign="left">
> 
> 
>   
>click="addRow()"/>
>   
>  
> 
>         columnName="label" />
> columnName="Number" />
>
> 
>  
> 
> 
> -Original Message-
> From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
> Behalf Of Tracy Spratt
> Sent: Wednesday, March 29, 2006 7:16 PM
> To: flexcoders@yahoogroups.com
> Subject: RE: [flexcoders] Re: databinding issue for combobox
> 
> Item objects(rows) contain multiple properties(columns).
> 
> Is the structure of the item object the same for the combobox
> dataProvider and the DataGrid dataProvider?
> 
> If so you should be able to simply specify the combobox 
selectedItem as
> the argument to addItem. Maybe you have to cast the selectedItem as
> Object?
> 
> If the two item objects are not the same structure then you are on 
the
> right track, but you want to put the property balue in the new 
property,
> not the whole item object.  Maybe:
> dgResources.addItem( {dept: cmbDept.selectedItem.dept} );
> 
> I'll see if I can do a quick example, and see what works.
> 
> Tracy
> 
> -Original Message-
> From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
> Behalf Of rgwilson26
> Sent: Wednesday, March 29, 2006 4:35 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: databinding issue for combobox
> 
> I actually have multiple columns in my dg which is why I am using 
> dgResources.addItem( {dept: cmbDept.selectedItem} ); 
> I cut down the example for simplicity. However, I did try the 
example 
> you suggested and it gives me a statement incomplete error. I think 
> it needs a identifier for each specific column. 
> 
> Would I have to somehow loop through the new object in the combo 
box 
> and pull each specific item out? 
> 
> --- In flexcoders@yahoogroups.com, "Tracy Spratt"  wrote:
> >
> > When you do this:
> > dgResources.addItem( {dept: cmbDept.selectedItem} ); }
> > 
> > you are putting the whole combobox item object into the dept 
> property of
> > a new object.
> > 
> > Perhaps you just want:
> > dgResources.addItem(cmbDept.selectedItem);
> > 
> > Tracy
> > 
> > 
> > -Original Message-
> > From: flexcoders@yahoogroups.com 
> [mailto:[EMAIL PROTECTED] On
> > Behalf Of rgwilson26
> > Sent: Wednesday, March 29, 2006 10:16 AM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Re: databinding issue for combobox
> > 
> > Basically I am calling a query that will populate a combobox. 
Then 
> > the user will be able to use a click event that will send that 
> value 
> > from the combo box to a datagrid. Right now it sends a value from 
> the 
> > combobox to the datagrid, but what is displayed is [object 
Object] 
> > instead of the desired value. 
> > 
> > Here is an example:
> > 
> > 

RE: [flexcoders] Re: databinding issue for combobox

2006-03-30 Thread Stefan Richter





Sorry to hijack this thread.
 
Thanks for the example Tracy. I have somewhat changed 
it for Flex2 and run into a small issue. I am using 2 ArrayCollections, one for 
the combobox and one for the datagrid:
 
  [Bindable]  public  var 
cbDP:ArrayCollection;  [Bindable]  public  var 
dgDP:ArrayCollection;public function 
initData():void  {   cbDP = new 
ArrayCollection([ {label:"A", Number:0}, {label:"B", 
Number:1}, {label:"C", 
Number:2}]   );   dgDP = new 
ArrayCollection();  }
 
I then 'shift' one item from the combobox to the 
datagrid:
 
  private function 
addRow():void  {   dgDP.addItem(cboSource.selectedItem); // cboSource is the actual component on 
stage  }
 
This 
works fine. But when I add the same item multiple times to the datagrid then 
only ther last added item out of the group of same items is selectable in the 
datagrid. This must be an easy one to fix but I am not sure what is going 
wrong.
 
I 
noticed that the mx_internal_uid is the same for all 'same' items 
in the grid.
 
Any 
help appreciated.
 
Stefan
 
 
 
 





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



   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.



  









RE: [flexcoders] Re: databinding issue for combobox

2006-03-29 Thread Tracy Spratt
And here is an enhanced example that has both the same structure and
different structures.
Tracy

http://www.macromedia.com/2003/mxml"; 
initialize="initApp()"
 horizontalAlign="left">







   
  
 
 
 
  
   







   
  
 
 
 
  
   




-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Wednesday, March 29, 2006 8:32 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re: databinding issue for combobox

Here is a sample app that migh approach what you want.  It assumes the
item object structures are the same for both controls.

Tracy


http://www.macromedia.com/2003/mxml"; 
 horizontalAlign="left">





   
  
 
 
 
  
   


-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Wednesday, March 29, 2006 7:16 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re: databinding issue for combobox

Item objects(rows) contain multiple properties(columns).

Is the structure of the item object the same for the combobox
dataProvider and the DataGrid dataProvider?

If so you should be able to simply specify the combobox selectedItem as
the argument to addItem. Maybe you have to cast the selectedItem as
Object?

If the two item objects are not the same structure then you are on the
right track, but you want to put the property balue in the new property,
not the whole item object.  Maybe:
dgResources.addItem( {dept: cmbDept.selectedItem.dept} );

I'll see if I can do a quick example, and see what works.

Tracy

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of rgwilson26
Sent: Wednesday, March 29, 2006 4:35 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: databinding issue for combobox

I actually have multiple columns in my dg which is why I am using 
dgResources.addItem( {dept: cmbDept.selectedItem} ); 
I cut down the example for simplicity. However, I did try the example 
you suggested and it gives me a statement incomplete error. I think 
it needs a identifier for each specific column. 

Would I have to somehow loop through the new object in the combo box 
and pull each specific item out? 

--- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> When you do this:
> dgResources.addItem( {dept: cmbDept.selectedItem} ); }
> 
> you are putting the whole combobox item object into the dept 
property of
> a new object.
> 
> Perhaps you just want:
> dgResources.addItem(cmbDept.selectedItem);
> 
> Tracy
> 
> 
> -Original Message-
> From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
> Behalf Of rgwilson26
> Sent: Wednesday, March 29, 2006 10:16 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: databinding issue for combobox
> 
> Basically I am calling a query that will populate a combobox. Then 
> the user will be able to use a click event that will send that 
value 
> from the combo box to a datagrid. Right now it sends a value from 
the 
> combobox to the datagrid, but what is displayed is [object Object] 
> instead of the desired value. 
> 
> Here is an example:
> 
> 

RE: [flexcoders] Re: databinding issue for combobox

2006-03-29 Thread Tracy Spratt
Here is a sample app that migh approach what you want.  It assumes the
item object structures are the same for both controls.

Tracy


http://www.macromedia.com/2003/mxml"; 
 horizontalAlign="left">





   
  
 
 
 
  
   


-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Wednesday, March 29, 2006 7:16 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re: databinding issue for combobox

Item objects(rows) contain multiple properties(columns).

Is the structure of the item object the same for the combobox
dataProvider and the DataGrid dataProvider?

If so you should be able to simply specify the combobox selectedItem as
the argument to addItem. Maybe you have to cast the selectedItem as
Object?

If the two item objects are not the same structure then you are on the
right track, but you want to put the property balue in the new property,
not the whole item object.  Maybe:
dgResources.addItem( {dept: cmbDept.selectedItem.dept} );

I'll see if I can do a quick example, and see what works.

Tracy

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of rgwilson26
Sent: Wednesday, March 29, 2006 4:35 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: databinding issue for combobox

I actually have multiple columns in my dg which is why I am using 
dgResources.addItem( {dept: cmbDept.selectedItem} ); 
I cut down the example for simplicity. However, I did try the example 
you suggested and it gives me a statement incomplete error. I think 
it needs a identifier for each specific column. 

Would I have to somehow loop through the new object in the combo box 
and pull each specific item out? 

--- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> When you do this:
> dgResources.addItem( {dept: cmbDept.selectedItem} ); }
> 
> you are putting the whole combobox item object into the dept 
property of
> a new object.
> 
> Perhaps you just want:
> dgResources.addItem(cmbDept.selectedItem);
> 
> Tracy
> 
> 
> -Original Message-
> From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
> Behalf Of rgwilson26
> Sent: Wednesday, March 29, 2006 10:16 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: databinding issue for combobox
> 
> Basically I am calling a query that will populate a combobox. Then 
> the user will be able to use a click event that will send that 
value 
> from the combo box to a datagrid. Right now it sends a value from 
the 
> combobox to the datagrid, but what is displayed is [object Object] 
> instead of the desired value. 
> 
> Here is an example:
> 
> 

RE: [flexcoders] Re: databinding issue for combobox

2006-03-29 Thread Tracy Spratt
Item objects(rows) contain multiple properties(columns).

Is the structure of the item object the same for the combobox
dataProvider and the DataGrid dataProvider?

If so you should be able to simply specify the combobox selectedItem as
the argument to addItem. Maybe you have to cast the selectedItem as
Object?

If the two item objects are not the same structure then you are on the
right track, but you want to put the property balue in the new property,
not the whole item object.  Maybe:
dgResources.addItem( {dept: cmbDept.selectedItem.dept} );

I'll see if I can do a quick example, and see what works.

Tracy

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of rgwilson26
Sent: Wednesday, March 29, 2006 4:35 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: databinding issue for combobox

I actually have multiple columns in my dg which is why I am using 
dgResources.addItem( {dept: cmbDept.selectedItem} ); 
I cut down the example for simplicity. However, I did try the example 
you suggested and it gives me a statement incomplete error. I think 
it needs a identifier for each specific column. 

Would I have to somehow loop through the new object in the combo box 
and pull each specific item out? 

--- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> When you do this:
> dgResources.addItem( {dept: cmbDept.selectedItem} ); }
> 
> you are putting the whole combobox item object into the dept 
property of
> a new object.
> 
> Perhaps you just want:
> dgResources.addItem(cmbDept.selectedItem);
> 
> Tracy
> 
> 
> -Original Message-
> From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
> Behalf Of rgwilson26
> Sent: Wednesday, March 29, 2006 10:16 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: databinding issue for combobox
> 
> Basically I am calling a query that will populate a combobox. Then 
> the user will be able to use a click event that will send that 
value 
> from the combo box to a datagrid. Right now it sends a value from 
the 
> combobox to the datagrid, but what is displayed is [object Object] 
> instead of the desired value. 
> 
> Here is an example:
> 
> 

[flexcoders] Re: databinding issue for combobox

2006-03-29 Thread rgwilson26
I actually have multiple columns in my dg which is why I am using 
dgResources.addItem( {dept: cmbDept.selectedItem} ); 
I cut down the example for simplicity. However, I did try the example 
you suggested and it gives me a statement incomplete error. I think 
it needs a identifier for each specific column. 

Would I have to somehow loop through the new object in the combo box 
and pull each specific item out? 

--- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> When you do this:
> dgResources.addItem( {dept: cmbDept.selectedItem} ); }
> 
> you are putting the whole combobox item object into the dept 
property of
> a new object.
> 
> Perhaps you just want:
> dgResources.addItem(cmbDept.selectedItem);
> 
> Tracy
> 
> 
> -Original Message-
> From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
> Behalf Of rgwilson26
> Sent: Wednesday, March 29, 2006 10:16 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: databinding issue for combobox
> 
> Basically I am calling a query that will populate a combobox. Then 
> the user will be able to use a click event that will send that 
value 
> from the combo box to a datagrid. Right now it sends a value from 
the 
> combobox to the datagrid, but what is displayed is [object Object] 
> instead of the desired value. 
> 
> Here is an example:
> 
> 

Re: [flexcoders] Re: databinding issue for combobox

2006-03-29 Thread Jignesh Dodiya



I think there is problem at dgResources.addItem   ,..not sure but may bethere the fault
 
On 3/30/06, Tracy Spratt <[EMAIL PROTECTED]> wrote:

When you do this:
dgResources.addItem( {dept: cmbDept.selectedItem} ); }
you are putting the whole combobox item object into the dept property ofa new object.Perhaps you just want:dgResources.addItem(cmbDept.selectedItem);
Tracy-Original Message-From: 
flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] OnBehalf Of rgwilson26

Sent: Wednesday, March 29, 2006 10:16 AMTo: 
flexcoders@yahoogroups.comSubject: [flexcoders] Re: databinding issue for comboboxBasically I am calling a query that will populate a combobox. Then the user will be able to use a click event that will send that value 
from the combo box to a datagrid. Right now it sends a value from the combobox to the datagrid, but what is displayed is [object Object] instead of the desired value. Here is an example:

RE: [flexcoders] Re: databinding issue for combobox

2006-03-29 Thread Tracy Spratt
When you do this:
dgResources.addItem( {dept: cmbDept.selectedItem} ); }

you are putting the whole combobox item object into the dept property of
a new object.

Perhaps you just want:
dgResources.addItem(cmbDept.selectedItem);

Tracy


-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of rgwilson26
Sent: Wednesday, March 29, 2006 10:16 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: databinding issue for combobox

Basically I am calling a query that will populate a combobox. Then 
the user will be able to use a click event that will send that value 
from the combo box to a datagrid. Right now it sends a value from the 
combobox to the datagrid, but what is displayed is [object Object] 
instead of the desired value. 

Here is an example:


[flexcoders] Re: databinding issue for combobox

2006-03-29 Thread Cristian Pop
Hi,

First problem I see with this code (... label="Add" click="{addRow()}
..") is tha in the click event I don;t think you need the {}. You can
put AS code there. 
Second what happens is probably that CF adapter returns the array of
objects with properties in upper case, so .DATA and .LABEL. The combo
box looks for them in lower case.

If you are using beta 2 cf adapter (i don;t know if this works in beta
1 aswell) you can set some properties to convert the return objects
fomr CF to lowercase. Look for the  section in your
flex-enterprise-services.xml file.

Another option (i used this before finding the case settings) is to
"fix" the case in the return result object. Something like:

public function fixCase(types: ArrayCollection):ArrayCollection {
  var newTypes:ArrayCollection = new ArrayCollection();
  for (var i:int; i < types.length;i++) {
 newTypes.addItem(
{data:types.getItemAt(i).DATA,
 label:types.getItemAt(i).LABEL}
 ); }
return newTypes;
}   

Cristian

--- In flexcoders@yahoogroups.com, "rgwilson26" <[EMAIL PROTECTED]> wrote:
>
> I tried using both cmbDept.selectedItem.data or 
> cmbDept.selectedItem.label, but it displays nothing inside the 
> datagrid. With cmbDept.selectedItem it displays [object Object] for 
> each click event.
> 
> --- In flexcoders@yahoogroups.com, "Anatole Tartakovsky" 
>  wrote:
> >
> > And you are looking for 
> > cmbDept.selectedItem.data or cmbDept.selectedItem.label?
> > 
> > 
> >   - Original Message - 
> >   From: rgwilson26 
> >   To: flexcoders@yahoogroups.com 
> >   Sent: Wednesday, March 29, 2006 10:15 AM
> >   Subject: [flexcoders] Re: databinding issue for combobox
> > 
> > 
> >   Basically I am calling a query that will populate a combobox. 
> Then 
> >   the user will be able to use a click event that will send that 
> value 
> >   from the combo box to a datagrid. Right now it sends a value from 
> the 
> >   combobox to the datagrid, but what is displayed is [object 
> Object] 
> >   instead of the desired value. 
> > 
> >   Here is an example:
> > 
> >   

[flexcoders] Re: databinding issue for combobox

2006-03-29 Thread rgwilson26
I tried using both cmbDept.selectedItem.data or 
cmbDept.selectedItem.label, but it displays nothing inside the 
datagrid. With cmbDept.selectedItem it displays [object Object] for 
each click event.

--- In flexcoders@yahoogroups.com, "Anatole Tartakovsky" 
<[EMAIL PROTECTED]> wrote:
>
> And you are looking for 
> cmbDept.selectedItem.data or cmbDept.selectedItem.label?
> 
> 
>   - Original Message - 
>   From: rgwilson26 
>   To: flexcoders@yahoogroups.com 
>   Sent: Wednesday, March 29, 2006 10:15 AM
>   Subject: [flexcoders] Re: databinding issue for combobox
> 
> 
>   Basically I am calling a query that will populate a combobox. 
Then 
>   the user will be able to use a click event that will send that 
value 
>   from the combo box to a datagrid. Right now it sends a value from 
the 
>   combobox to the datagrid, but what is displayed is [object 
Object] 
>   instead of the desired value. 
> 
>   Here is an example:
> 
>   

Re: [flexcoders] Re: databinding issue for combobox

2006-03-29 Thread Anatole Tartakovsky





And you are looking 
for 
cmbDept.selectedItem.data or 
cmbDept.selectedItem.label?
 

  - Original Message - 
  From: 
  rgwilson26 
  To: flexcoders@yahoogroups.com 
  Sent: Wednesday, March 29, 2006 10:15 
  AM
  Subject: [flexcoders] Re: databinding 
  issue for combobox
  Basically I am calling a query that will populate 
  a combobox. Then the user will be able to use a click event that will send 
  that value from the combo box to a datagrid. Right now it sends a value 
  from the combobox to the datagrid, but what is displayed is [object 
  Object] instead of the desired value. Here is an 
  example:

[flexcoders] Re: databinding issue for combobox

2006-03-29 Thread rgwilson26
Basically I am calling a query that will populate a combobox. Then 
the user will be able to use a click event that will send that value 
from the combo box to a datagrid. Right now it sends a value from the 
combobox to the datagrid, but what is displayed is [object Object] 
instead of the desired value. 

Here is an example:


[flexcoders] Re: databinding issue for combobox

2006-03-28 Thread Jignesh Dodiya
it may be possible that you sending full object to Datagrid. not
sure but it may posible that u need to send the specific element from
your object from combo-box to datagrid with specific column id...i
mean object.columnID

An object automatically settle to data grid with column name while
retriving form data base...

On 3/28/06, Tracy Spratt <[EMAIL PROTECTED]> wrote:
>   [object Object] means you are trying to display a complex object as
>  text.
>
>  Can you be more specific about what you mean when you say " send the
>  results from the combobox to a datagrid "?
>
>  Tracy
>
>  -Original Message-
>  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
>  Behalf Of rgwilson26
>  Sent: Tuesday, March 28, 2006 2:41 PM
>  To: flexcoders@yahoogroups.com
>  Subject: [flexcoders] databinding issue for combobox
>
>  I am working on an app where I am populating various combo boxes with
>  results from my look up tables in a sql server database. I have no
>  problem binding the results to the comboboxes dataProvider property.
>  However, when I try to send the results from the combobox to a datagrid
>  it populates the datagrid field with [object Object] instead of the
>  selected item value.
>
>  I can call a query and populate a datagrid directly and it doesn't seem
>  to be an issue, so I am a little confused as to why it is a problem
>  going from a combobox to a datagrid?
>
>  Any suggestions?
>
>
>
>
>
>
>
>  --
>  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
>
>
>
>
>  SPONSORED LINKS
>
>
>  Web site design development
>   Computer software development
>   Software design 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.
>
>  
>
>


--
jignesh dodiya


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

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

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

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