-
5 Jan 2013 4:17 PM #1
Keep ComboBox on selected item on expand
Keep ComboBox on selected item on expand
When I create a simple combo box I see that, when I expand, it starts at the selected item but then scrolls to the top. Is there a way to keep it scrolled to the selection?
Code:public class ComboBoxScrollToTop implements EntryPoint { @Override public void onModuleLoad() { SimpleComboBox<String> field = new SimpleComboBox<String>(new StringLabelProvider()); field.setTriggerAction(TriggerAction.ALL); for (int i = 1; i < 100; i++) { field.add(String.valueOf(i)); } field.setValue("90"); RootPanel.get().add(field); } }
-
6 Jan 2013 9:53 AM #2
I've moved this to our Bugs forum and opened an internal issue to track this - this can pretty clearly be reproduced on http://www.sencha.com/examples/
-
6 Jan 2013 12:13 PM #3
It appears I'm mistaken, and that this has been fixed - the issue that can be reproduced at the link above cannot be seen on the nightly build at http://staging.sencha.com:8080/examp...Place:combobox
Here's a workaround that seems to be a workaround in a 3.0.1 project:
Code:field.addExpandHandler(new ExpandHandler() { @Override public void onExpand(ExpandEvent event) { String selected = field.getValue(); final int index = field.getStore().indexOf(selected); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { field.getListView().getElement(index).scrollIntoView(); } }); } });
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTGWT-2735
in
a recent build.


Reply With Quote