2 Replies Latest reply on Sep 13, 2007 11:34 AM by jfb00

    error #1034

    jfb00 Level 3
      Hi All,
      I have a comboBox inside a datagrid and with a datagridEvent I'm trying to do some calculations after a combobox change.
      I have this code in my fucntion
      var chosenItem:Object =
      ComboBox(event.currentTarget.itemEditorInstance).selectedItem;
      Error: cannot convert components::itemComboBoxRate@c51d479 to
      mx.controls.ComboBox.

      Anybody can help me with this?
      Tks

      JFB
        • 1. Re: error #1034
          levancho Level 3
          event.currentTarget.itemEditorInstance is not instance of ComboBox but it i instance of itemComboBoxRate which I don't know what it its probably your custom component.
          • 2. Re: error #1034
            jfb00 Level 3
            Tks for reply and help
            If I try the inline component is not working either I got the same error.
            Error #1034: Type Coercion failed: cannot convert NewEstimate_inlineComponent1@c7050a1 to mx.controls.ComboBox.

            Here is my code in my datagrid with inline component... let me know if you need any more details.
            Rgds


            public function calculateRateTotal(event:DataGridEvent):void{
            if (event.reason == DataGridEventReason.OTHER ||
            event.reason == DataGridEventReason.CANCELLED){
            // Do not update cell.
            return;
            }
            if(event.dataField == "rateid") {
            var chosenItem:Object = ComboBox(event.currentTarget.itemEditorInstance).selectedItem;
            var chosenRateId:int = chosenItem.rateid;

            }
            <mx:DataGrid id="price_dg" itemEditEnd="calculateRateTotal(event)" x="10" y="28" width="590" height="147" editable="true">
            <mx:columns>
            <mx:DataGridColumn headerText="Quantity" dataField="qty"/>
            <mx:DataGridColumn headerText="Rate Type" dataField="rateid" rendererIsEditor="true" width="120">
            <mx:itemRenderer >
            <mx:Component >
            <mx:VBox>
            <mx:ComboBox id="rate_cb" dataProvider="{outerDocument.acRate}" labelField="label" change="outerDocument.setRate(rate_cb)" width="120"/>
            </mx:VBox>
            </mx:Component>
            </mx:itemRenderer>
            </mx:DataGridColumn>
            <mx:DataGridColumn headerText="per Piece" dataField="perpiece" editable="false"/>
            <mx:DataGridColumn headerText="per 1000" dataField="per1000" editable="false" labelFunction="formatNumber"/>
            <mx:DataGridColumn headerText="Setup Fee" dataField="setupfee" />
            <mx:DataGridColumn headerText="Total" dataField="total" editable="false" />
            </mx:columns>
            </mx:DataGrid>