2 Replies Latest reply on Mar 29, 2010 5:37 PM by polob4385

    Pass dataprovider to component's child via application (mxml)

    polob4385

      Hi there,

       

      I know this may seem like a fairly simple question but i have a component that is  a vbox with a advanceddatgrid as its child. I call the component in the application part but do not really know how to pass the the components child a dataprovider from the application any help or links? I googled  but didnt really understand soem of the things I read. Here is my code, fairly short.

       

      component:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" label="PeopleOnline">
      <mx:Script source="TradeClientSum.as" />
          <mx:AdvancedDataGrid id="clsum" designViewDataType="flat" width="100%" height="100%">
              <mx:columns>
                  <mx:AdvancedDataGridColumn headerText="Name" dataField="col1"/>
                  <mx:AdvancedDataGridColumn headerText="country" dataField="col2"/>
                  <mx:AdvancedDataGridColumn headerText="CID" dataField="col3"/>
              </mx:columns>
          </mx:AdvancedDataGrid>
      </mx:HBox>

       

       

      application:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:VDividedBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" xmlns:local="components.*" >
          <mx:AdvancedDataGrid id="sessionsgrid" designViewDataType="flat" width="100%" height="100%" dataProvider="{session}"  allowMultipleSelection="true" creationComplete="init()" itemClick="itemClickGridEvent(event)">
              <mx:columns>
                  <mx:AdvancedDataGridColumn headerText="" dataField="isonline" width="35">
                  </mx:AdvancedDataGridColumn>
                  <mx:AdvancedDataGridColumn headerText="X" dataField="status" width="35">
                  </mx:AdvancedDataGridColumn>
                  <mx:AdvancedDataGridColumn headerText="user" dataField="session" width="100"/>
                  <mx:AdvancedDataGridColumn headerText="Host" dataField="hostport" width="100"/>
                  <mx:AdvancedDataGridColumn headerText="id" dataField="id" width="100"/>
                  <mx:AdvancedDataGridColumn headerText="community" dataField="purpose"/>
              </mx:columns>
          </mx:AdvancedDataGrid>
          </mx:VBox>
          <mx:TabNavigator width="100%" height="0%">
           <local:compnent id="test"> <!-- this is the hbox but want to pass a dataprovider to advanceddatagrid in it? -->
            </mx:TabNavigator>
      </mx:VDividedBox>