17 Dec 2011 8:58 AM #1
SimpleComboBox -> sort
I want to sort items of SimpleComboBox<String> after I added a new item to it dynamically.
Is there a good solution to sort item of a SimpleComboBox<String>?
SimpleComboBox<String> = ...
String newItem = "a new item";
// now, have to reorder items of it
18 Dec 2011 1:29 AM #2
I don't use this but I suppose you can sort the Store of a SimpleComboBox too.
19 Dec 2011 12:15 AM #3
Thank you for your answer. After it I have found the good solution:
(1) I have made a base modell data and a store:
public class Apple extends BaseModelData
ListStore<Apple> appleStore = new ListStore<Apple>();
(2) I made a good working equals method!
(3) I use ComboBox instead of SimpleComboBox
(4) add a new item and sort my store:
Apple newAppleModel = new Apple( "red", 13);
if ( ! appleStore.contains(newAppleModel) ) // it uses the equals method!
15 Feb 2012 1:45 AM #4
I had the same problem but I finally found out