1 Reply Latest reply on Feb 28, 2008 7:15 AM by nrutter

    Combo Box inside dataGrid

    nrutter Level 1
      I have looked everywhere and I am having a hard time finding a good example of how to use a combo box in a datagrid. I want to use a dataprovider for my datagird but as soon as I get inside my itemRenderer it throws an error saying Access of undefined property model even though it is defined above. Can someone please help me. I may be way off??

      <mx:DataGrid x="10" y="10" width="840" height="120" dataProvider="{model.acProducts}">
      <mx:columns>
      <mx:DataGridColumn dataField="UPC Number">
      <mx:itemRenderer>
      <mx:Component>
      <mx:ComboBox
      dataProvider="{model.acProducts}"/>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>
      <mx:DataGridColumn dataField="proddesc" headerText="Product Name" />
      <mx:DataGridColumn headerText="Lot Number" />
      <mx:DataGridColumn headerText="Product Category" />
      <mx:DataGridColumn headerText="EPA" />
      <mx:DataGridColumn headerText="AE Count">
      <mx:itemRenderer>
      <mx:Component>
      <mx:HBox horizontalAlign="center">
      <mx:Script>
      <![CDATA[
      [Bindable]
      public var selected:Boolean;
      ]]>
      </mx:Script>
      <mx:CheckBox id="displayCheckBox" click="selected = displayCheckBox.selected"/>
      </mx:HBox>
      </mx:Component>
      </mx:itemRenderer>

      </mx:DataGridColumn>
      </mx:columns>
      </mx:DataGrid>
        • 1. Re: Combo Box inside dataGrid
          nrutter Level 1
          i got it. Heres the code for everyone who is wondering

          <mx:DataGrid x="10" y="10" width="840" height="120" dataProvider="{model.acProducts}" ro>
          <mx:columns>
          <mx:DataGridColumn dataField="UPC Number">
          <mx:itemRenderer>
          <mx:Component>
          <mx:HBox>
          <mx:Script>
          <![CDATA[
          import com.serg.reportingTool.model.SergReportingToolModelLocator;
          [Bindable] private var model:SergReportingToolModelLocator = SergReportingToolModelLocator.getInstance();
          ]]>
          </mx:Script>
          <mx:ComboBox
          id="occurenceCode"
          labelField="OccurrenceCode"
          dataProvider="{model.acOccurrences}"
          />
          </mx:HBox>
          </mx:Component>
          </mx:itemRenderer>
          </mx:DataGridColumn>
          <mx:DataGridColumn dataField="proddesc" headerText="Product Name" />
          <mx:DataGridColumn headerText="Lot Number" />
          <mx:DataGridColumn headerText="Product Category" />
          <mx:DataGridColumn headerText="EPA" />
          <mx:DataGridColumn headerText="AE Count">
          <mx:itemRenderer>
          <mx:Component>
          <mx:HBox horizontalAlign="center">
          <mx:Script>
          <![CDATA[
          [Bindable]
          public var selected:Boolean;
          ]]>
          </mx:Script>
          <mx:CheckBox id="displayCheckBox" click="selected = displayCheckBox.selected"/>
          </mx:HBox>
          </mx:Component>
          </mx:itemRenderer>

          </mx:DataGridColumn>
          </mx:columns>
          </mx:DataGrid>