0 Replies Latest reply on Nov 25, 2007 10:33 AM by ntsiii

    ComboBox itemRenderer

    ntsiii Level 3
      Often we need a ComboBox item renderer in a dataGrid column. To be
      useful, the ComboBox needs to display the currently selected item for
      each row, must update the dataProvider item when the user selects an
      option in the drop list, and must optionally be able to get its drop
      list items dynamically from the main dataProvider item.

      The attached example uses an extended ComboBox to do the item <=> value
      synchronization.

      There are so many possible ways to structure data that a single generic
      solution is very difficult to envision. I approached this by
      abstracting the "setup" into itemRenderer "wrappers". The wrappers allow
      specifying both the list dataProvider source, and the "field" in the
      list dataProvider items that contains the option values. There are
      sample three renderers, each using a different main dataProvider and
      different ways to get the ComboBox list items. Unless you can build the
      intelligence into your data to specify the location and structure of the
      drop list dataProvider, you will almost certainly need a renderer for
      each ComboBox column

      The requirements for functionality and abstraction make this example a
      bit complex, consisting of 5 files, but each component is quite simple,
      so take a look if you need this functionality. The renderers use no
      containers.

      I am not using this in production anywhere, so consider it just an
      example.

      Zip file contents:
      TestCBORenderer.mxml -- The test app
      ComboBoxSelectedValue.mxml -- provides the value to list synchronization
      DGIR_DynamicDP.mxml -- DataGrid ItemRenderer with dynamic CBO lists
      DGIR_DynamicDP_XML.mxml -- DataGrid ItemRenderer with dynamic CBO
      XMLList
      DGIR_StaticDP_XML.mxml -- DataGrid ItemRenderer with Static CBO List in
      Array variable

      This is implemented in heavily commented mxml, with everything in the
      same folder, for simplicity as an example.

      The example is available here:
      http://www.cflex.net/showfiledetails.cfm?ChannelID=1&Object=File&objectI
      D=767

      Tracy Spratt