2 Replies Latest reply on Oct 8, 2008 6:58 AM by Newsgroup_User

    Combobox in Datagrid

    happybrowndog
      How do I get the combobox that is a renderer in a datagrid's column to show the value that correlates to the datagrid's dataprovider data?

      Here is the XML for the dataProvider of the datagrid:
      <items>
      <item>
      <productnumber>1</productnumber>
      <color>red</color>
      <price>12.00</price>
      </item>
      <item>
      <productnumber>2</productnumber>
      <color>blue</color>
      <price>15.00</price>
      </item>
      <item>
      <productnumber>3</productnumber>
      <color>white</color>
      <price>10.00</price>
      </item>
      </items>

      Here is the XML of the dataProvider for the combobox:
      <colors>
      <color>black</color>
      <color>green</color>
      <color>blue</color>
      <color>yellow</color>
      <color>white</color>
      <color>red</color>
      <color>gray</color>
      </colors>

      So in other words, the datagrid will show a row for each <item>, and the column that shows <color> is a combobox, and I want the combobox to be showing the correct <color> in the list of <colors>. I do know that the datagrid column for the combobox is an itemRenderer, but how do I get the combobox to set the right <color> with the dataProvider=<colors> ?

      Can someone please give me an example or point me to one?

      Thanks.