Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    54
    Vote Rating
    0
    DarekKay is on a distinguished road

      0  

    Default (Beta) ComboBox issues

    (Beta) ComboBox issues


    First of all - thanks again for all the fixes in beta. Now I found another two ComboBox issues:

    1.) onValueChange-event doesn't fire automatically after selecting an item (you have to press return to achieve this)

    2.) ComboBox.setEnabled(false) makes the TextField disabled, but you can still select other items and change the value by pressing the arrow.

  2. #2
    Sencha User
    Join Date
    Mar 2008
    Location
    Berlin
    Posts
    25
    Vote Rating
    0
    madmaxmatze is on a distinguished road

      0  

    Default I can confirm this problem!

    I can confirm this problem!


    With Dev Preview 5 this problem was not existing. My current workaround is to use the CollapseHandler.

    The issue can be tested using:
    Code:
    LabelProvider<String> comboLabelProvider = new LabelProvider<String>() {
    	@Override
    	public String getLabel(String item) {
    		return item;
    	}
    };
    
    final SimpleComboBox<String> comboBox = new SimpleComboBox<String>(comboLabelProvider);
    comboBox.setTriggerAction(TriggerAction.ALL);
    comboBox.add("value1");
    comboBox.add("value2");
    comboBox.add("value3");
    comboBox.add("value4");
    comboBox.addValueChangeHandler(new ValueChangeHandler<String>() {
    	@Override
    	public void onValueChange(ValueChangeEvent<String> event) {
    		Info.display("ValueChangeHandler", "new Value: " + event.getValue());
    	}
    });
    comboBox.addChangeHandler(new ChangeHandler() {
    	@Override
    	public void onChange(ChangeEvent event) {
    		Info.display("ChangeHandler", "new Value: " + event.getSource());
    	}
    });
    comboBox.addCollapseHandler(new CollapseHandler() {
    	@Override
    	public void onCollapse(CollapseEvent event) {
    		Info.display("CollapseHandler", "new Value: " + comboBox.getCurrentValue());
    		// workaround to force trigger of ValueChangeHandler
    		// comboBox.setValue(comboBox.getCurrentValue(), true);
    	}
    });
    
    RootLayoutPanel.get().add(comboBox);

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    54
    Vote Rating
    0
    DarekKay is on a distinguished road

      0  

    Default


    Quote Originally Posted by madmaxmatze View Post
    With Dev Preview 5 this problem was not existing. My current workaround is to use the CollapseHandler.
    I use that workaround, too. But is there any possibility, this one gets fixed?

  4. #4
    Sencha User
    Join Date
    Dec 2011
    Posts
    22
    Vote Rating
    0
    EthiC is on a distinguished road

      0  

    Default


    Any word about the ComboBox not firing the valueChangeEvent untill focus is lost?

    Added to that, if I do a: (the 2 booleans can be omitted)
    PHP Code:
    comboBox.setValue(comboBoxValuetruetrue); 
    The event is fired as it is supposed too, but the combobox itself still displays the empty message, instead of the selected value.
    <-- solution was to remove the statement setting the empty text
    Last edited by EthiC; 23 Dec 2011 at 7:28 AM. Reason: added solution

  5. #5
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Any word about the ComboBox not firing the valueChangeEvent untill focus is lost?
    That is the expected behaviour as with any other field too.

  6. #6
    Sencha User
    Join Date
    Dec 2011
    Posts
    22
    Vote Rating
    0
    EthiC is on a distinguished road

      0  

    Default


    Thank you for your quick reply.
    In 2.x we used a SelectionChangedListener on the ComboBox and that did fire that event after selecting the item with the mouse.
    I guess we'll use the CollapsedHandler then for this situation.

  7. #7
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    You should be able to get the ListView from the ComboBox instance, get the selection model and on that you can listen to the SelectionChangedEvent

  8. #8
    Sencha User
    Join Date
    Dec 2011
    Posts
    22
    Vote Rating
    0
    EthiC is on a distinguished road

      0  

    Default


    Doesn't seem to work for me:
    The selectionModel's selectionChangedHandler and selectionHandler receive events when the list is openened and if an item is being hovered. (selectionChangedHandler seems to even break the combobox when used (in debug mode + Chrome))
    I only need the actual click event, which doesn't trigger an event in these cases.
    Code:
            ListViewSelectionModel<Breakdown> selectionModel = presenter.getView().getTitleComboBox().getListView().getSelectionModel();
            selectionModel.addSelectionHandler(new SelectionHandler<Breakdown>() {
                @Override
                public void onSelection(SelectionEvent<Breakdown> event) {
                    System.out.println("on selection " + event.getSelectedItem() + " type: " + event.getAssociatedType());
                }
            });
    Last edited by EthiC; 23 Dec 2011 at 8:26 AM. Reason: added chrome

  9. #9
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Sorry i was wrong. It uses an event preview internly. You will need to use the same kind of logic. Take a look at init(ListStore<T> store) of ComboBoxCell

  10. #10
    Sencha User
    Join Date
    Sep 2010
    Posts
    6
    Vote Rating
    0
    XGhost is on a distinguished road

      0  

    Default


    Guys,

    Is there another way to execute some logic right after user has changed ComboBox value? I've got ComboBox and Grid on my page and I need to refresh Grid data every time user changes ComboBox value.

    I can understand that comboBox.addValueChangeHandler(...) works only when comboBox losts a focus. Is there any simple way to handle select event for ComboBox?