It sounds like when you click the button, you're changing the dataprovider
of the combobox.

I think that when you add your new value to the combobox, you need to
re-select the previously selected value. Just store the last selected value
somewhere in your component for reference when you need it.

Shan

On 11/6/07, phdcpe01 <[EMAIL PROTECTED]> wrote:
>
>   I have:
> 1. an ArrayCollection
> 2. A datagrid that displays the info in the arraycollection
> 3. A combobox which allows one to control which elements of the array
> collection are shown in the datagrid.
> 4. a filter array function.
>
> The items in the arraycollection can be of type X, Y, or Z. As a new
> type is added, the type name appears in the combobox. The combobox
> item is used to filter the arraycollection.
> When the user clicks a button, a new element is added. Basically,
> what I do is have a buttonclick() method that adds the element. This
> method then calls filterarray() to refilter the array according to
> what is specified in the combobox. However, between buttonclick() and
> filterarray(), the combobox's item is changed, so it filters on the
> wrong item.
>
> Example:
> Combox box contains X, and Y (X was added first).
> I select Y, and datagrid show's all the Y's.
> I add a new Y (done in buttonclick()), and then call filterarray().
> Filterarray is called, and filters based on X (datagrid shows all the
> X's)
>
> I've done a trace in both buttonclick and filterarray. In
> buttonclick, it says the combobox has Y selected. In filterarray, it
> says X is selected.
> How do I keep the combobox from changing itself?
>
>  
>

Reply via email to