View Full Version : How to get the index number or text value from ComboBox?
15 Mar 2011, 1:05 AM
Anyone can guide me how to get the index number or text value from ComboBox?
I suppouse you mean the index number and text value of the "item" selected.
You can get the "item" selected by
comboBox.getValue(). Then get the value of the property set as "DisplayField" in the comboBox.
The index in the comboBox (D is the ModelData used)
ListStore<D> store = comboBox.getStore();
15 Mar 2011, 7:58 AM
Thank you for replying.
I am able to get the index number of the combobox selected. However, I am still doubt on how to get the value of combobox. When I use comboBox.getValue(), it returns me the 'address' value (Hex value). Please show me the code.
I am not fully understand this sentence..."Then get the value of the property set as "DisplayField" in the comboBox."
Sorry for my bad understanding cause I am new to Java and GXT too.
15 Mar 2011, 8:04 AM
Object displayedValue = comboBox.getValue().get(comboBox.getDisplayField());
15 Mar 2011, 4:58 PM
It works fine to get the index number and value of combobox for me as codes shown above.
A suggestion to the GXT API Doc. The explanation of the GXT API too brief and no example codes how to use the methods. The MSDN is the example of good documentation to refer which provided very details and sample codes to guide you how to use the methods/functions.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.