Cache problem in Combo Box.

Hi All,

Presently I have a problem with ComboBox cache.

I have two combo box. The value of the second combobox changes based on the selected value from the first combo box.
So whenever, a value is selected from the first combo box, i am removing all items from the second and populating the second combo box.

Now
1.select a value from the first combo box.
2.select a value from the second combo box ( values are loaded dynamically ). Lets assume this value as 2.
3.Again reselect a value from the first combo box.
4.Try, Clicking on the combo box without selecting any value, the preivously selected value i.e 2 is getting displayed, even though it is not being selected.


how to over come this kind of cache ?

i have attached a test file ( rename to .java )to create this scenario,
try selecting value 1 from the first combo box, so that the second combo box will be populated. select a value in second combo box.
then select a new value from combo box one, after that click on the second combo box.

Thnx n Regardz
Vasu Patnaik.
11271.doc (1.88 KB)

Tested with your code and you are right. The old value lingers there although the cb2 does not actually contain the value anymore. It does not show by default, but clicking the combobox brings it visible.

Created a ticket for this:
http://dev.vaadin.com/ticket/4607

Hi Sami,

Thanks for the effort. -_-

Thnx n Regardz
Vasu Patnaik.

Unfortunately,

It appears that this issue is still occurring in 6.4. I am implementing an identical functionality and I still get a value that is no longer in the IndexedContainer that is backing my Select component to linger around when I place focus on the Select then leave the field without selecting anything. (a la this ticket: http://dev.vaadin.com/ticket/4607)

I am not removing the items iteratively as the OP did (I’m assuming that he/she removed the items iteratively based on their post, as I didn’t inspect their source). I’m simply rebuilding the back end datasource then calling setContainerDataSource passing in the new container which (I assumed) effectively swaps out the items that are selectable in the Select, this works wonderfully however I still get the cached value on the client side which is invalid and shouldn’t remain.

Thoughts?

Thanks in Advance for any help/Guidance on this…

  • Will

Sounds like a bug unless you are doing something weird with the container. Do you have a test case that shows the problem? If so, please create a ticket at http://dev.vaadin.com

No problem. I just put together a test case that reproduces the issue I’m having.

Here are the steps to reproduce:

  1. Select a “master” option.
  2. Ensure that the “slave” options correspond to that “master”.
  3. Choose a slave option and take note of which one was chosen.
  4. Select a different master option.
  5. Notice that the slave option that was selected clears visually.
  6. Place focus in the slave dropdown (WITHOUT SELECTING ANYTHING).
  7. Leave the slave dropdown notice that the slave dropdown populates with stale data that is no longer a part of the data source backing the select component.
    11421.java (4.85 KB)

Just providing an update on this. I created this ticket: http://dev.vaadin.com/ticket/5556 in regards to this issue.

  • Will