PDA

View Full Version : ComboBox issue



cupakob
10 May 2010, 1:37 AM
Hi *,

my combobox is set as follow:


statusListBox = new ComboBox<ModelData>();
ListStore<ModelData> list = createListStore();
statusListBox.setStore(list);I want to remove one/two of the possible choice options, but i can't find an way to make this. For example, if i want to remove the third and fourth entry:


statusListBox.remove(2);
statusListBox.remove(3);Can someone tell me, how can I make this (or to create a new list ist the only one way)?

Thanks in advance!

sven
10 May 2010, 1:38 AM
Remove it on the store

cupakob
10 May 2010, 9:55 PM
A new try:


ListStore<ModelData> listEditMode = statusListBox.getStore();

ModelData data = new BaseModelData();
data.set("status", Pruefungsstatus.started);
data.set("display", Pruefungsstatus.started);

listEditMode.remove(data);

statusListBox.setStore(listEditMode);But the combobox still contains all entries and nothing was deleted. Any suggestions?

micgala
10 May 2010, 11:53 PM
That is not the way to do it... you are trying to remove something that is not in the store.
For removing it, you need to pass the real model to the remove method.
You can get it using store.getAt(int).