RE: [flexcoders] Flex 2.0: DataGrid.addChild - TypeError

2005-11-29 Thread Matt Chotin
Title: Flex 2.0: DataGrid.addChild - TypeError










Yeah, this is not how you get data into
the DataGrid.  Just assign dataGrid.dataProvider = dataProvider and see if that
will work for you.

 









From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Michel Bertrand
Sent: Wednesday, November 23, 2005
4:53 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex 2.0:
DataGrid.addChild - TypeError



 

Hello
! 

I've
got "TypeError: Error #1034: Type Coersion failed: cannot convert
[EMAIL PROTECTED] to flash.display.DisplayObject" in Flex 2.0.

I
have the error using mx.controls.DataGrid in the following way: 

   
   
   
    var dataProvider:Array = new Array(); 
   
   
   
    
   
   
   
    var obj:Object = new Object(); 
   
   
   
    obj.roleName = "Profile 1"; 
   
   
   
    dataProvider[0] = obj; 
   
   
   
    
   
   
   
    obj = new Object(); 
   
   
   
    obj.roleName = "Profile 2"; 
   
   
   
    dataProvider[1] = obj; 

   
   
   
    var column:DataGridColumn = new DataGridColumn(); 
   
   
   
    column.columnName =
"roleName"; 
   
   
   
    column.headerText =
"Avaible Profiles"; 
       
   
    avaibleProfilesColumns[0] = column; 

   
   
   
    ... 

   
   
    if (dataProvider != null && dataProvider.length > 0) { 
   
   
   
    for (var i:int=0;i

   
   
   
   
    dataGrid.addChild(dataProvider[i]); 
   
   
   
    } 
   
   
    } 

My
"dataGrid" has all settings to handle data properly and it's shown
all data, but it always produces the error above too.

Any
idea to workaround this situation ? Has anybody faced it ? 

Thanks
in advance ! 
Michel.











--
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] Flex 2.0: DataGrid.addChild - TypeError

2005-11-23 Thread Manish Jethani
On 11/23/05, Michel Bertrand <[EMAIL PROTECTED]> wrote:

> I've got "TypeError: Error #1034: Type Coersion failed: cannot convert [EMAIL 
> PROTECTED] to flash.display.DisplayObject" in Flex 2.0.
[snip]

> if (dataProvider != null && dataProvider.length > 0) {
> for (var i:int=0;i dataGrid.addChild(dataProvider[i]);
> }
> }

Only objects of type DisplayObject can be added to a
DisplayObjectContainer (like DataGrid). You should be getting a
compilation error on this.

In any case, the correct way to populate a DataGrid is by setting the
'dataProvider' property, not by adding children to it.

Manish


 Yahoo! Groups Sponsor ~--> 
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/nhFolB/TM
~-> 

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




[flexcoders] Flex 2.0: DataGrid.addChild - TypeError

2005-11-23 Thread Michel Bertrand
Title: Flex 2.0: DataGrid.addChild - TypeError








Hello !


I've got "TypeError: Error #1034: Type Coersion failed: cannot convert [EMAIL PROTECTED] to flash.display.DisplayObject" in Flex 2.0.

I have the error using mx.controls.DataGrid in the following way:


                var dataProvider:Array = new Array();

                

                var obj:Object = new Object();

                obj.roleName = "Profile 1";

                dataProvider[0] = obj;

                

                obj = new Object();

                obj.roleName = "Profile 2";

                dataProvider[1] = obj;


                var column:DataGridColumn = new DataGridColumn();

                column.columnName = "roleName";

                column.headerText = "Avaible Profiles";

                avaibleProfilesColumns[0] = column;


                ...


            if (dataProvider != null && dataProvider.length > 0) {

                for (var i:int=0;i

                    dataGrid.addChild(dataProvider[i]);

                }

            }


My "dataGrid" has all settings to handle data properly and it's shown all data, but it always produces the error above too.

Any idea to workaround this situation ? Has anybody faced it ?


Thanks in advance !

Michel.









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