Yeah... that does not make sense to me.
I would stick this in a stand-alone case, and see if Isomorphic can explain on the forum, or if it clearly does not work as documented, open an issue here:
http://code.google.com/p/smartgwt/issues/list.
Announcement
Collapse
No announcement yet.
X
-
Hi Thanks for the quick response,
Code:If set to false, if a value has been entered that does not match an entry in the ValueMap or a value loaded from the optionDataSource, it will be discarded if the user leaves the field. When this mode is enabled, getValue will return null unless the value typed in by the user has valid matches. Use ComboBoxItem.getEnteredValue to get the raw value typed in by the user.
However if the user clicked on "High" from the Dropdown list (or type it) - as "High" is in the dropdown selection and contained in the ValueMap it should not be ignored and the selection should not default back..? This is not what was happening!
Are you sure this is the intended functionality? This conflicts with what is stated in the first line of the documentation - I do want to ignore any value which has been entered that does not match an entry in the ValueMap when the user leaves the field. However I do not want to ignore a value selected from the dropdown selection. Therefore should i not set the value to false? What does setting it to false achieve?
Maybe I am completely misreading the docs and i'm sorry if i am but i have read over this multiple times to see if it make sense to have the problem i described with that option set to false and I just cant make sense of it..
Thanks,
Leave a comment:
-
The documentation for setAddUnknownValues () says:
Code:public void setAddUnknownValues(Boolean addUnknownValues) If set to false, if a value has been entered that does not match an entry in the ValueMap or a value loaded from the optionDataSource, it will be discarded if the user leaves the field. When this mode is enabled, getValue will return null unless the value typed in by the user has valid matches. Use ComboBoxItem.getEnteredValue to get the raw value typed in by the user. Note that this flag effectively enables completeOnTab, since leaving the field in general (whether by tab or another means) will attempt completion, and discard the value if no valid completion exists. As with completeOnTab, if the typed in value has more than one match, the first match will be used. Parameters: addUnknownValues - addUnknownValues Default value is true
Then you can call getEnteredValue () to get the value entered by the user.
Though I am not sure how you tell it apart from a "picked" value... you may have to compare the value returned via getEnteredValue () to each value you added to the combo-box to make sure it is indeed a value that's not already in the box...
Leave a comment:
-
ComboBoxItem Value Reset on Focus Lost
Library Version:
SmartGWT 2.4
GWT 2.1.1
Firefox 3.6.8
Hi,
I am having an issue with ComboBoxItem where the value which is selected from the drop down list is reset to the defaultValue as soon as any other component is clicked on any other form or panel.
I have added event handlers to it to see if it is ever receiving the change event and noticed that some handlers are never called.. I have tested the following:
ChangeHandler - never called
ChangedHandler - never called
FocusHandler - called
ClickHandler - called
I assume the fact that it is not receiving events has something todo with it resetting..
The code to create the ComboBoxItem is as follows:
Code:LinkedHashMap<String, String> values = new LinkedHashMap<String, String>(); values.put("Low", "Low"); values.put("Medium", "Medium"); values.put("High", "High"); ComboBoxItem item = createComboBoxItem("Test", "Low", values); DynamicForm form = new DynamicForm(); form.setNumCols(2); form.setWidth100(); form.setTitleWidth("*"); form.setFields(item); .... public static ComboBoxItem createComboBoxItem(String title, String defaultItem, LinkedHashMap<String, String> values) { ComboBoxItem item = new ComboBoxItem(); item.setTitle(title); item.setTitleAlign(Alignment.LEFT); item.setWidth(95); item.setAddUnknownValues(false); item.setValueMap(values); item.setDefaultValue(defaultItem); return item; }
this is then added to a forum and then to a DynamicForm which in turn is added to a HLayout.. There are many different ComboBoxItems in the application but all of them are located on different Form's.. I don't know if this matters or not but i'm trying to give as much info as possible..
I am using firefox 3.6.8 and have also tested in Chrome (i know there is an issue with ComboBoxItem in Chrome even with the latest GWT update where google were supposed to have it fixed in 2.1 -- i have commented here about this http://code.google.com/p/smartgwt/issues/detail?id=386 )..
There are no errors or warnings whatsoever produced in any console...
Any help is greatly appreciated..
Thanks,Tags: None
Leave a comment: