0 Replies Latest reply on Feb 23, 2008 8:51 AM by aligned2009

    AdvancedDataGrid width resizing

    aligned2009 Level 1
      If I have an AdvancedDataGrid, which contains columns that have an ItemRenderer. The ItemRenderer width exceeds the width of the AdvancedDataGrid. How can I get the width of the widest item in the ItemRenderer and set the width pcol.width after the creation is complete??

      I'm going to use events sourced from the renderer to the data grid unless someone else has a better idea :)

      private function resizeWidth():void{
      pcol.width=150; //I'd like this to be the widest value in the ItemRenderer!
      }
      <mx:AdvancedDataGrid id="dg" dataProvider="{contacts_xml..contact}"
      creationComplete="resizeWidth()"
      height="100%">
      <mx:columns>
      <mx:AdvancedDataGridColumn dataField="last_name" headerText="Last Name" />
      <mx:AdvancedDataGridColumn dataField="first_name" headerText="First Name" />
      <mx:AdvancedDataGridColumn id="pcol" dataField="phone_numbers" headerText="Phone Numbers"/>
      <mx:AdvancedDataGridColumn dataField="address" headerText="Address" />
      <mx:AdvancedDataGridColumn dataField="city" headerText="City" />
      <mx:AdvancedDataGridColumn dataField="state" headerText="State" />
      <mx:AdvancedDataGridColumn dataField="zip" headerText="Zip" />
      </mx:columns>
      <mx:rendererProviders>
      <mx:AdvancedDataGridRendererProvider
      column="{pcol}"
      renderer="util.PhoneRenderer"/>
      </mx:rendererProviders>
      </mx:AdvancedDataGrid>