Would be awesome!
  waiting your replay then.

  see ya!

       Luis




Michael Labriola escreveu:

>
> Luis,
>
> I agree it would be a good feature. Just as an FYI, I submitted it
> previously as a feature request to Adobe.
>
> On a side note, next week I will be back at the office, and I will
> post the solution to the sorting problem you had as well.
>
> Mike
>
> --- In flexcoders@yahoogroups.com 
> <mailto:flexcoders%40yahoogroups.com>, Luis Eduardo <[EMAIL PROTECTED]> 
> wrote:
> >
> >
> >
> > Michael,
> >
> > i subclassed the datagrid and the datagridcolumn because i saw too
> > much issues being resolved on this way. (unfortunately).
> > i dont know much flex neither actionscript, but i read a lot on
> > documentation and tried a lot of tests. Spent 4 hours on this trying to
> > do the "right" thing instead of traversing "by hand" the datapath of
> the
> > xml...
> > but damn !!! actionscript is too much temperamental! clearly a
> > limitation (not a bug) that only root nodes can be evaluated with []s.
> > is there any place which we can ask for this feature to adobe? would
> > be great!
> >
> > but... in mean time... thank you very much for your help bro!
> >
> > my code, inside the extendes class become (with proper credit ;)
> >
> ----------------------------------------------------------
> >
> >
> > override public function itemToLabel(data:Object):String {
> > if (!data)
> > return " ";
> >
> > if (labelFunction != null)
> > return labelFunction(data, this);
> >
> > if (owner.labelFunction != null)
> > return owner.labelFunction(data, this);
> >
> > if (typeof(data) == "xml") {
> > data = deriveComplexColumn( data, dataField
> ).toString();
> > }
> >
> > if (typeof(data) == "object") {
> > try {
> > data = data[dataField];
> > }
> > catch(e:Error) {
> > data = null;
> > }
> > }
> >
> > if (data is String)
> > return String(data);
> >
> > try {
> > return data.toString();
> > }
> > catch(e:Error) {
> > }
> >
> > return " ";
> > }
> >
> > // function from Michael Labriola from Flexcoders mail list
> > protected function deriveComplexColumn( data:Object,
> > complexFieldName:String ):Object {
> > var dataPtr:Object = data;
> > var complexName:Array = complexFieldName.split( '.', 10 );
> >
> > for each ( var key:String in complexName ) dataPtr =
> > dataPtr[ key ];
> > return dataPtr;
> > }
> >
> ----------------------------------------------------------
> >
> > the bad thing is that now sorting on the datagridcolumn doesn't work
> > anymore... and need to be made "by hand" again...
> > argh!
> > will just wait for the client ask for this. ;)
> >
> > best regards!
> >
> > Luís Eduardo.
> >
> >
> >
> > Michael Labriola escreveu:
> >
> > >
> > > You are correct. By default the dataField on DataGridColumn only goes
> > > to the root level of the structure you are passing.
> > >
> > > If you are feeling a little ambitious, you can subclass dataGridColumn
> > > and do something like this:
> > >
> > > protected function deriveComplexColumn( data:Object,
> > > complexFieldName:String ):Object
> > > {
> > > var dataPtr:Object;
> > >
> > > dataPtr = data;
> > >
> > > var complexName:Array;
> > > complexName = complexFieldName.split( '.', 10 );
> > >
> > > for each ( var key:String in complexName )
> > > {
> > > dataPtr = dataPtr[ key ];
> > > }
> > >
> > > return dataPtr;
> > > }
> > >
> > > Then in your itemToLabel method, you can replace this:
> > >
> > > > try
> > > > {
> > > > data = data[dataField];
> > > > }
> > >
> > > with this:
> > > try
> > > {
> > > data = deriveComplexColumn( data, dataField );
> > > }
> > >
> > > ...If you don't want to make your own subclass of dataField, then you
> > > could do the same thing with an itemRenderer or a labelFunction.
> > >
> > > So:
> > >
> > > public function myLabelFunc( row:Object, column:DataGridColumn
> ):String {
> > > return deriveComplexColumn( row, column.dataField ) as String;
> > > }
> > >
> > > Have fun,
> > > Mike
> > >
> > > --- In flexcoders@yahoogroups.com 
> <mailto:flexcoders%40yahoogroups.com>
> > > <mailto:flexcoders%40yahoogroups.com>, Luis Eduardo <illogic_code@>
> > > wrote:
> > > >
> > > >
> > > > yeah... i guess too that if the xml had another format it should
> > > work...
> > > > but it can't have another format... :(.
> > > > the servlets are coded already and they return a xml that have the
> > > > format i presented on this sample.
> > > > not the same data, but this is the format.
> > > >
> > > > i search inside the DataGridColumn.as code and find a function named
> > > > "itemToLabel" that have this portion of code:
> > > >
> > > > if (typeof(data) == "object" || typeof(data) == "xml")
> > > > {
> > > > try
> > > > {
> > > > data = data[dataField];
> > > > }
> > > > catch(e:Error)
> > > > {
> > > > data = null;
> > > > }
> > > > }
> > > >
> > > > so, i guess that this way of getting data from a XML (using
> brackets)
> > > > only can fetch one level of info on the xml format. Not inside his
> > > > childrens.
> > > > in the end, this line of code will probably be evaluated to this:
> > > data
> > > > = [EMAIL PROTECTED]
> > > > To me, this is a bug.... or, being optmistic, a limitation.
> > > >
> > > > can someone confirm that? Tracy? Gordon? anyone?
> > > >
> > > >
> > > >
> > > >
> > > > thunderstumpgesatwork escreveu:
> > > >
> > > > > Hi,
> > > > >
> > > > > my guess is that your "dataField" cannot support the complex
> > > > > "[EMAIL PROTECTED]"... it should be just a single field name.
> > > > >
> > > > > To me the XML makes more sense (and is simpler) like this:
> > > > >
> > > > > > <mx:XMLList id="employees">
> > > > > > <employee Id="1" gender="female">
> > > > > > <name>Christina Coenraets</name>
> > > > > > </employee>
> > > > > > <employee Id="2" gender="male">
> > > > > > <name>Maurice Smith</name>
> > > > > > </employee>
> > > > > > </mx:XMLList>
> > > > >
> > > > > this makes your dataField just "@gender" which I think should
> work.
> > > > >
> > > > > good luck.
> > > > >
> > > > > --- In flexcoders@yahoogroups.com 
> <mailto:flexcoders%40yahoogroups.com>
> > > <mailto:flexcoders%40yahoogroups.com>
> > > > > <mailto:flexcoders%40yahoogroups.com>, Luis Eduardo
> <illogic_code@>
> > > > > wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > i could solve part of my problem with a workaround, but not
> all is
> > > > > > working ok. (i could display the data but the sorting
> capability is
> > > > > gone).
> > > > > > someone have an ideia of how to make this on the rigth path?
> > > > > > i am using the "labelFunction" property of the datagrid like
> this:
> > > > > >
> > > > > > <?xml version="1.0"?>
> > > > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml 
> <http://www.adobe.com/2006/mxml>
> > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml>>
> > > > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml>
> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml>>>">
> > > > > > <mx:Script>
> > > > > > <![CDATA[
> > > > > > public function getRowLabel(item:Object,
> > > > > > column:DataGridColumn):String {
> > > > > > return [EMAIL PROTECTED];
> > > > > > }
> > > > > > ]]>
> > > > > > </mx:Script>
> > > > > >
> > > > > > <mx:XMLList id="employees">
> > > > > > <employee Id="1">
> > > > > > <name gender="female">Christina Coenraets</name>
> > > > > > </employee>
> > > > > > <employee Id="2">
> > > > > > <name gender="male">Maurice Smith</name>
> > > > > > </employee>
> > > > > > </mx:XMLList>
> > > > > >
> > > > > > <mx:Panel title="DataGrid Control Example" height="100%"
> > > > > width="100%"
> > > > > > paddingTop="10" paddingLeft="10" paddingRight="10">
> > > > > >
> > > > > > <mx:DataGrid id="dg" width="100%" height="100%" rowCount="5"
> > > > > > dataProvider="{employees}">
> > > > > > <mx:columns>
> > > > > > <mx:DataGridColumn dataField="@Id" headerText="ID"/>
> > > > > > <mx:DataGridColumn dataField="[EMAIL PROTECTED]"
> > > > > > headerText="Gender" labelFunction="getRowLabel"/>
> > > > > > <mx:DataGridColumn dataField="name" headerText="Name"/>
> > > > > > </mx:columns>
> > > > > > </mx:DataGrid>
> > > > > >
> > > > > > <mx:Form width="100%" height="100%">
> > > > > > <mx:FormItem label="Id">
> > > > > > <mx:Label text="[EMAIL PROTECTED]"/>
> > > > > > </mx:FormItem>
> > > > > > <mx:FormItem label="Name">
> > > > > > <mx:Label text="{dg.selectedItem.name}"/>
> > > > > > </mx:FormItem>
> > > > > > <mx:FormItem label="Gender">
> > > > > > <mx:Label text="[EMAIL PROTECTED]"/>
> > > > > > </mx:FormItem>
> > > > > > </mx:Form>
> > > > > >
> > > > > > </mx:Panel>
> > > > > > </mx:Application>
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > ----------------------------------------------------------
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > Luis Eduardo escreveu:
> > > > > >
> > > > > > >
> > > > > > > hi,
> > > > > > >
> > > > > > > i dont know why but my datagrid cant bind well when the format
> > > of one
> > > > > > > XML have childrens.
> > > > > > > i borrow the example on the documentation and make a test to
> > > you guys
> > > > > > > see what i am talking about.
> > > > > > > to see the issue, just select one row and watch the Labels
> get the
> > > > > > > "gender" property on the right way but, using the same
> > > notation, the
> > > > > > > grid can't show the values.
> > > > > > >
> > > > > > > thx for the help,
> > > > > > >
> > > > > > > Luís Eduardo.
> > > > > > >
> > > > > > > <?xml version="1.0"?>
> > > > > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml 
> <http://www.adobe.com/2006/mxml>
> > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml>>
> > > > > <http://www.adobe.com/2006/mxml 
> <http://www.adobe.com/2006/mxml> <http://www.adobe.com/2006/mxml 
> <http://www.adobe.com/2006/mxml>>>
> > > > > > > <http://www.adobe.com/2006/mxml 
> <http://www.adobe.com/2006/mxml>
> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml>>
> > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> 
> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml>>>>">
> > > > > > > <mx:XMLList id="employees">
> > > > > > > <employee Id="1">
> > > > > > > <name gender="female">Christina Coenraets</name>
> > > > > > > </employee>
> > > > > > > <employee Id="2">
> > > > > > > <name gender="male">Maurice Smith</name>
> > > > > > > </employee>
> > > > > > > </mx:XMLList>
> > > > > > >
> > > > > > > <mx:Panel title="DataGrid Control Example" height="100%"
> > > width="100%"
> > > > > > > paddingTop="10" paddingLeft="10" paddingRight="10">
> > > > > > >
> > > > > > > <mx:DataGrid id="dg" width="100%" height="100%" rowCount="5"
> > > > > > > dataProvider="{employees}">
> > > > > > > <mx:columns>
> > > > > > > <mx:DataGridColumn dataField="@Id" headerText="ID"/>
> > > > > > > <mx:DataGridColumn dataField="[EMAIL PROTECTED]"
> > > > > > > headerText="Gender"/>
> > > > > > > <mx:DataGridColumn dataField="name" headerText="Name"/>
> > > > > > > </mx:columns>
> > > > > > > </mx:DataGrid>
> > > > > > >
> > > > > > > <mx:Form width="100%" height="100%">
> > > > > > > <mx:FormItem label="Id">
> > > > > > > <mx:Label text="[EMAIL PROTECTED]"/>
> > > > > > > </mx:FormItem>
> > > > > > > <mx:FormItem label="Name">
> > > > > > > <mx:Label text="{dg.selectedItem.name}"/>
> > > > > > > </mx:FormItem>
> > > > > > > <mx:FormItem label="Gender">
> > > > > > > <mx:Label text="[EMAIL PROTECTED]"/>
> > > > > > > </mx:FormItem>
> > > > > > > </mx:Form>
> > > > > > >
> > > > > > > </mx:Panel>
> > > > > > > </mx:Application>
> > > > > > >
> > > > > > >
> > > > > > > _______________________________________________________
> > > > > > > O Yahoo! está de cara nova. Venha conferir!
> > > > > > > http://br.yahoo.com <http://br.yahoo.com> 
> <http://br.yahoo.com <http://br.yahoo.com>>
> <http://br.yahoo.com <http://br.yahoo.com>
> > > <http://br.yahoo.com <http://br.yahoo.com>>> <http://br.yahoo.com 
> <http://br.yahoo.com> <http://br.yahoo.com <http://br.yahoo.com>>
> > > > > <http://br.yahoo.com <http://br.yahoo.com> 
> <http://br.yahoo.com <http://br.yahoo.com>>>>
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > _______________________________________________________
> > > > > > Novidade no Yahoo! Mail: receba alertas de novas mensagens
> no seu
> > > > > celular. Registre seu aparelho agora!
> > > > > > http://br.mobile.yahoo.com/mailalertas/ 
> <http://br.mobile.yahoo.com/mailalertas/>
> > > <http://br.mobile.yahoo.com/mailalertas/ 
> <http://br.mobile.yahoo.com/mailalertas/>>
> > > > > <http://br.mobile.yahoo.com/mailalertas/ 
> <http://br.mobile.yahoo.com/mailalertas/>
> > > <http://br.mobile.yahoo.com/mailalertas/ 
> <http://br.mobile.yahoo.com/mailalertas/>>>
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > > _______________________________________________________
> > > > Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu
> > > celular. Registre seu aparelho agora!
> > > > http://br.mobile.yahoo.com/mailalertas/ 
> <http://br.mobile.yahoo.com/mailalertas/>
> > > <http://br.mobile.yahoo.com/mailalertas/ 
> <http://br.mobile.yahoo.com/mailalertas/>>
> > > >
> > >
> > >
> >
> >
> >
> >
> > _______________________________________________________
> > O Yahoo! está de cara nova. Venha conferir!
> > http://br.yahoo.com <http://br.yahoo.com>
> >
>
>  



                
_______________________________________________________ 
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. 
Registre seu aparelho agora! 
http://br.mobile.yahoo.com/mailalertas/ 
 



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

Reply via email to