All,

I came up with alternative to using a label function.


Use an inline itemRenderer:
then reference it as "data.name.first"  where data is the 
dataprovider's "list item".

Note: To reference the the selected item;
use:  myGrid.selectedItem.name.first

eg:
        <mx:TextArea x="10" y="302" width="289" height="89" 
text="{myGrid.selectedItem.name.first}"/>



     <mx:itemRenderer>
                      <mx:Component>
                             <mx:Text text="{data.name.first}"/>
                        </mx:Component>
      </mx:itemRenderer>


Full snip for Datagrid:

        <mx:DataGrid x="307" y="10" dataProvider="{myEmployee}"  >
                        <mx:columns>
         <mx:DataGridColumn headerText="First Name">
                      <mx:itemRenderer>
                      <mx:Component>
                             <mx:Text text="{data.name.first}"/>
                        </mx:Component>
                      </mx:itemRenderer>
             </mx:DataGridColumn>

 <mx:DataGridColumn headerText="Last Name">
                      <mx:itemRenderer>
                      <mx:Component>
                             <mx:Text text="{data.name.last}"/>
                        </mx:Component>
                      </mx:itemRenderer>
             </mx:DataGridColumn>

                                <mx:DataGridColumn 
headerText="Department" dataField="department"/>
                        <mx:DataGridColumn headerText="Email" 
dataField="email"/>
                </mx:columns>
        </mx:DataGrid>





--- In [email protected], "dzeitman" <[EMAIL PROTECTED]> wrote:
>
> All,
> Does anyone understand why this databinding doesn't work. It seems 
> like this is a significant bug.
> 
> Example shows a form with several fields,  a data model, bindings, 
a 
> grid and a second form to echo the data.  Clearly the bindings work 
> as the second form echos the first, the top level objects, email 
and 
> description also work, it's the nested objects that don't work on 
the 
> grid.
> 
> This the datagrid does work as I would I would expect:
> 
> Any thoughts would be appreciated.
> 
> <!-- Example-->
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
>               layout="absolute">
>               
> 
> <!-- Form contains user input controls. -->
>     <mx:Form label="Employee Information">
>         <mx:FormItem label="First Name">
>             <mx:TextInput id="firstName"/>
>         </mx:FormItem>
>         <mx:FormItem label="Last Name">
>             <mx:TextInput id="lastName"/>
>         </mx:FormItem>
>         <mx:FormItem label="Department">
>             <mx:TextInput id="department"/>
>         </mx:FormItem>
>         <mx:FormItem label="Email Address">
>             <mx:TextInput id="email"/>
>         </mx:FormItem>
> </mx:Form>
> 
> <!-- The myEmployee data model. -->
> <mx:Model id="myEmployee">
>     <Employee>
>         <name>
>             <first/>
>             <last/>
>         </name>
>         <department/>
>         <email/>
>     </Employee>
> </mx:Model>
> 
> 
> <mx:Binding source="firstName.text" 
> destination="myEmployee.name.first"/>
> <mx:Binding source="lastName.text" 
> destination="myEmployee.name.last"/>
> <mx:Binding source="department.text" 
> destination="myEmployee.department"/>
> <mx:Binding source="email.text" destination="myEmployee.email"/>
> 
> 
>       <mx:DataGrid x="394" y="0" dataProvider="{myEmployee}">
>                       <mx:columns>
>                       <mx:DataGridColumn headerText="First Name" 
> dataField="name.first"/>
>                       <mx:DataGridColumn headerText="Last Name" 
> dataField="name.last"/>
>                       <mx:DataGridColumn headerText="Department" 
> dataField="department"/>
>                       <mx:DataGridColumn headerText="Email" 
> dataField="email"/>
>               </mx:columns>
>       </mx:DataGrid>
>  <mx:Form label="Employee Information Echo" x="10" y="156">
>         <mx:FormItem label="First Name">
>             <mx:TextInput  text="{myEmployee.name.first}"/>
>         </mx:FormItem>
>         <mx:FormItem label="Last Name">
>             <mx:TextInput  text="{myEmployee.name.last}"/>
>         </mx:FormItem>
>         <mx:FormItem label="Department">
>           <mx:TextInput  text="{myEmployee.department}"/>
>         </mx:FormItem>
>         <mx:FormItem label="Email Address">
>           <mx:TextInput  text="{myEmployee.email}"/>
>         </mx:FormItem>
> </mx:Form>
> 
> </mx:Application>
>


Reply via email to