tags:

views:

580

answers:

1

Hi,

I'm using a combo box control and the dataprovider is set as an XML. After the dataprovider is set, I want to edit the text of the first option and also I need to insert an item in the second position.

How can I do this? Using an ItemRenderer? Please give your suggestions.

A: 

You should edit the dataProvider itself. Make it an ArrayCollection (or something else that implements IList) and your combobox will automatically update as you make changes. Also make sure that the array collection is full of bindable objects.

Changing ArrayCollection is easy. You can just say dataProvider.getItemAt(0).labelProperty = "whatever" -- this assumes you have an object with a property of "labelProperty" and your combobox's labelField is set to it.

To add an item just use dataProvider.addItemAt(item, 1)

Sean Clark Hess
My dataprovider is an XML.myXML.xmltree[0]="Changed Value"; helped me to change the first item value. But the insertChildAfter() method is not working. The nodes are simply not getting inserted into the main XML. Any ideas?
whoopy_whale