0 Replies Latest reply on Oct 28, 2011 12:56 PM by Code Girl

    DropDownList casting problem

    Code Girl

      Table

      {

      int id

      string name

      }

      Tables extends table

      {

      Array<TableLinks> of children

      }

      TableLinks

      {

      Table rightTable

      }

       

      In flex, I get a list of Tables from my web service

      Display a combobox with the list of Tables

      Once someone selects from the list the list of TableLinks is populated in a datagrid

      in the rightTable column it displays the rightTable.name in the label

      When you edit the column a dropdownlist shows

       

      <mx:DataGridColumn id="tableNameDC"
         headerText="Table"
         editable="true"
         dataField="rightTable"
         labelFunction="tableFormat"
         editorDataField="value"
         width="150">

       

       

      Is there anyway to cast my Tables list to type Table here?

       

      Currently, I keep the list as Tables

      When you select and item the value is saved to a value object but casted from Tables to Table

      When you exit the dropdownlist the get value function returns the Table value Object.  But for some reason, it keeps telling me its null.

      Its as if when I cast the Tables item to Table it fails.

       

      public function get value():TableDto
      {
      return rightTableDto
      }
      protected function selectableDropDown_closeHandler(event:DropDownEvent):void
      {
      rightTableDto = selectableDropDown.selectedItem as TableDto;
      }

       

       

      So, if the first question is not doable,  what do you think I am doing wrong?