Results 1 to 2 of 2

Thread: ComboBox.setValue() ignored when called within ComboBox selection handler

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Jun 2013
    Location
    Berkeley CA
    Posts
    9

    Default ComboBox.setValue() ignored when called within ComboBox selection handler

    GXT 3.0.4
    GWT 2.5.1
    JDK 1.7.0

    Requirements:
    Within my application, when the user selects a new value in the combobox, I am required to confirm the user wants to change the selection. If the user rejects the confirmation (answers no), I am required to reset the comboBox to the previous value.

    The selection handler code that fulfills this feature is:
    Code:
    @Override
    public void onSelection(SelectionEvent<ListItem> event) {
    	final ListItem newSelection = event.getSelectedItem();
    	// confirm user wants to select item
    	if (Window.confirm("Select " + newSelection.getName() + " or revert to " + ((listItemSelected==null) ? "empty" : listItemSelected.getName() )+ " ?")) {
    		// save selected item and update label
    		listItemSelected = newSelection;
    		selectedItemLabel.setText(listItemSelected.getName());
    	} else {
    		// FAILURE TO RESET TO PREVIOUS SELECTION
    		itemComboBox.setValue(listItemSelected);
    	}
    	
    }
    });
    Unfortunately, the combobox does not reflect the setValue() call. It retains whatever the user selected.

    Is there a way to force the combo box to update properly? I've tried calling collapse(), select() and redraw() in different sequences but the display value is always what the user selected.

    I've attached a zip file containing a test harness project that shows the errant behavior.

    BTW, I believe this issue is similar to another problem listed as
    http://www.sencha.com/forum/showthread.php?272606-GXT-combo-box-displays-old-value-after-loading-new-ListStore-content

    Attached Files Attached Files
    Last edited by Stevko (UCB); 5 Nov 2013 at 4:54 PM. Reason: fixup code segment

  2. #2
    Sencha User
    Join Date
    Jun 2013
    Location
    Berkeley CA
    Posts
    9

    Default missing template parts

    Sorry, I missed a couple of template headings...

    Browser versions and OS
    Firefox latest, Chrome latest, Win7 fully patched


    Virtual Machine
    Both dedicated and virt hosts.

    Run mode
    Development mode and runtime mode

    Possible fix
    No workaround discovered

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •