Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Showpicker not selecting the corresponding value in dropdown

    Hi,

    When the user clicks on a comboBox (focusEvent), the dropdown list should already be shown (=requirement). However, when doing this, the corresponding value is not selected in the dropdown list?

    I have added a standalone test case, because I somewhat assumed that this would be normal behavior.

    After some more investigation, I discovered that it's the ComboBoxItem that is not doing this, but the SelectItem is doing this same functionality just fine?
    The issue can be reproduced via the showcase as well:
    http://www.smartclient.com/smartgwt/...bobox_category

    Select "Giraffe" in the combobox. Select "Japan" in the selectItem. When clicking on the pickerIcon of the combobox again, the first item ("Cat") is selected in the list, instead of the previously chosen value "Giraffe". When clicking on the dropdown of the selectItem, "Japan" is selected in the list (as expected).

    Could you please advice?

    Regards,
    Bart

    Code:
    public class Standalone implements EntryPoint {
    	
    	/**
    	 * Container for either the login window or the workspace;
    	 */
    	private static Canvas masterPanel = null;
    
    	
    	/**
    	 * TEST CASE 5: auto select default value
    	 * 
    	 * 
    	 * @sofhistory
    	 * 08-03-2011	bade	initial version
    	 * 
    	 * @see com.google.gwt.core.client.EntryPoint#onModuleLoad()
    	 *
    	 */
    	 public void onModuleLoad() {  
    		  		
    		//masterPanel should be a Layout
    		masterPanel = new Canvas(); 
    		masterPanel.setHeight100();
    		masterPanel.setWidth100();
    		masterPanel.setStyleName("pageBackground"); //background style from skin
    		
    		ComboBoxItem comboBox = new ComboBoxItem();   
            comboBox.setTitle("Select");   
            comboBox.setHint("<nobr>A ComboBox with styled entries</nobr>"); 
    		//when not focused, don't show picker icon
            comboBox.setShowPickerIcon(true);
            comboBox.setAddUnknownValues(false);
            comboBox.setDefaultToFirstOption(false);
            comboBox.setCompleteOnTab(true);
            	        
            LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
    	    valueMap.put("1", "Red");
    	    valueMap.put("2", "Green");
    	    valueMap.put("3", "Blue");	            
            comboBox.setValueMap(valueMap);
            
            comboBox.addFocusHandler(new FocusHandler() {
    			
    			public void onFocus(FocusEvent event) {
    				event.getItem().showPicker();
    			}
    		});
            
            comboBox.setValue(2);
    
            //the order list grid   
    	    DynamicForm form = new DynamicForm();   
    	    form.setHeight(170);   
    	    form.setWidth(500);	    
    	    form.setFields(comboBox);
    
    		masterPanel.addChild(form);
    		masterPanel.draw();	
    	}
    }

    #2
    The highlighted value is the value that will be selected as a completion, not the current value.

    Comment


      #3
      Sure, and how can you make the highlight the current value?
      I'm a bit suprised that there's no property for this.

      I mean, a user can click on a picker (just to see what is in the list) then press tab and without him wanting to do so, the value has changed anyway?!?
      In my humble opinion that isn't very "user" friendly.

      Moreover, the "highlight current value" behavior can be found throughout the rest of your product, but not on the comboBoxItem...
      unless you are using an option datasource, then the combobox is also behaving like the selectItem?

      Comment


        #4
        We agree that would be a bad experience, however, it doesn't actually happen (try it).

        Comment


          #5
          Sorry about that, it doesn't happen in the showcase (must have been seeing what I wanted to see), but it does happen in my standalone test case!

          I think the main reason is that my comboBoxItem is using
          setCompleteOnTab(true);

          Comment


            #6
            If completeOnTab is set then that's an explicit request for completion on tab. Consider that power users doing heads-down data entry may prefer that completion takes place in this circumstance (they might open the picklist from the keyboard via Alt-Down).

            Comment


              #7
              Back at work today and tried the showcase example again... and it's not doing what you say.
              I tried it on my laptop at home and indeed, it was working as you said, so maybe something with browser versions?

              I was able to reproduce it on both IE and FireFox.

              FireFox: 3.6.15
              Internet Explorer: 8.0.7600.16385
              Operating System: Windows 7

              If you want, I can make a small vid?

              Using the simple comboBoxItem example:

              Select "Giraffe" via clicking PickerIcon and selecting it from the list.
              => Giraffe is selected and displayed
              Click the pickerIcon again and the value "Cat" is highlighted iso "Giraffe".
              Last edited by bade; 9 Mar 2011, 00:36.

              Comment


                #8
                Yes - and "Cat" will be chosen if you hit Enter. It is also the place where navigation begins if you hit arrow keys.

                Comment


                  #9
                  Yes and even if the current value is "Giraffe" (and dropdown is showing) when you tab out, "Cat" will be chosen.
                  So, user changed value without him wanting to do so which I though we agreed on is a bad experience?

                  Ok, it's clear we are not seeing eye to eye on this, so could you give me a hint on how to set the highlight in the dropdown box
                  to the current value myself (keeping in mind that I'm using a valueMap)?

                  Thanks
                  Bart
                  Last edited by bade; 9 Mar 2011, 15:28.

                  Comment


                    #10
                    Have you tried my standalone test case?
                    It's the autoCompleteOnTab which is the difference between the showcase and my implementation.

                    Regards,
                    Bart

                    Comment


                      #11
                      You seem to be saying that you want a special case where, when completeOnTab is enabled, completion works differently if you open the ComboBoxItem from the mouse versus from the keyboard? This seems very surprising, and not really something we think should be implemented.

                      pickListProperties and pickListFields allow you to do a lot of customization. It's not clear whether they'll allow you to do this particular one.

                      Comment


                        #12
                        Basically, if the current value is selected in the dropdown (like with selectItem), then autocompletion will not behave differently.

                        It behaves differently now, because the current value is not selected in the drop down list.

                        Comment


                          #13
                          Just to close this out, the problem with that proposal is:

                          1. The most common values are typically at the top of the list, and not particularly likely to be adjacent to the current value, so it's more convenient to place the cursor at the top of the list.

                          2. The selected value may be way down the list, requiring extra fetch operations to retrieve if load on demand is engaged. And we do not want to create an inconsistency between how the control behaves with small vs larger datasets.

                          This is an intentional design choice, and not a bug. If you're interested in sponsoring the work necessary to add a different mode with the behavior you're looking for, it's a valid sponsorship.

                          Comment


                            #14
                            Alright, now I understand your point of view.

                            I'll go ahead and see how I can work with the picklist properties here... but haven't been very successful with those so far.

                            Thanks for the info!
                            Bart

                            Comment

                            Working...
                            X