Announcement

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

    SelectItem with Multiples and PickList

    Our test team reported an issue with a SelectItem in our app. It is set for multiples and a picklist like so:

    Code:
    layerItem.setMultiple(true);
    layerItem.setMultipleAppearance(MultipleAppearance.PICKLIST);
    They reported that when the picklist is given focus, and the user arrows down through the items in the picklist, all currently selected items in the picklist are deselected and the item that receives focus is selected. You can see this behavior in the showcase: http://www.smartclient.com/smartgwt/showcase/#multi_select_combobox_category

    This seems counter intuitive. The user is navigating through the options and shouldn't expect the selections to change, unless they take an action to select an item like pressing the space bar.

    Is it functioning as you intended? It doesn't seem useful to deselect all the items this way. Is there way to change the behavior so it won't deselect items as the user navigates the list with the arrow keys?

    Thanks,
    Chris

    #2
    You can set listGrid.arrowKeyAction to "focus" via pickListProperties to get the behavior you want (showing an indicator of position but not changing the selection).

    Comment


      #3
      I tried setting the arrowKeyAction to "focus" via the pickListProperties, and it had no effect.

      The javadoc for setArrowKeyAction says that "focus" is the default:

      Code:
      Action to perform when the listGrid has keyboard focus (but not editing focus) and a user presses the up or down arrow key. Possible values are: 
       "select": select the next row in the list (calls recordClick handler)
       "focus": move focus to the next row in the list without changing the selection
       "activate": select and activate the next row in the list (calls recordDoubleClick handler)
       "none": no action
       null: if selectionAppearance is "checkbox", behaves as if set to "focus"; otherwise, behaves as if set to "select"
      
      Note : This is an advanced setting
      
      Parameters:
       arrowKeyAction . See String. Default value is null
      It appears that "focus" doesn't behave as advertised - it doesn't move the to the next row in the list with out changing the selection.

      I tried "select", "Activate" and "none" as the arrowKeyAction with no success. None of them resulted in a widget that could be navigated purely with the keyboard, or had a reasonable behavior for a multi-select pick list.

      Here is test case that demonstrates the problem:

      Code:
      package com.smartgwt.sample.client;
      
      import com.google.gwt.core.client.EntryPoint;
      import com.google.gwt.core.client.GWT;
      import com.smartgwt.client.types.MultipleAppearance;
      import com.smartgwt.client.widgets.form.fields.SelectItem;
      import com.smartgwt.client.widgets.form.DynamicForm;
      import com.smartgwt.client.widgets.grid.ListGrid;
      import com.smartgwt.client.widgets.layout.VStack;
      
      /**
       * Entry point classes define <code>onModuleLoad()</code>.
       */
      public class CustomDS implements EntryPoint {
      
          /**
           * This is the entry point method.
           */
          public void onModuleLoad() {
      
              VStack vStack = new VStack();
              vStack.setLeft(175);
              vStack.setTop(75);
      
      	DynamicForm componentForm = new DynamicForm();
      	componentForm.setWidth("*");
      
      	SelectItem layerItem = new SelectItem("mapLayers", "Map Layers");
              layerItem.setMultiple(true);
      	layerItem.setMultipleAppearance(MultipleAppearance.PICKLIST);
      	layerItem.setWidth(140);
      	layerItem.setValueMap("400", "5000", "10000", "14000", "18000",
      		"24000", "30000", "34000", "39000", "45000", "53000");
      
      	ListGrid pickListProperties = new ListGrid();
      	pickListProperties.setArrowKeyAction("focus");
      	layerItem.setPickListProperties(pickListProperties);
      
      	componentForm.setFields(layerItem);
              vStack.addMember(componentForm);
      
              vStack.draw();
          }
      
      }
      It appears that the arrowKeyAction for "focus" is busted. Would you be able to fix it?

      I'm using SmartClient Version: v8.3p_2013-06-21/Enterprise Deployment (built 2013-06-21).

      Thanks,
      Chris

      Comment


        #4
        We see the problem you describe.
        We're looking into this and will follow up when we have more information.

        Thanks
        Isomorphic Software

        Comment


          #5
          Hi Chris,
          The reason arrowKeyAction is not having an impact here is that SelectItem pickLists are heavily customized ListGrids, and this focus-highlighting / selection behavior is overridden for them.
          We've spent some time looking into it and are modifying the behavior so that keyboard navigation for SelectItems with "multiple" set to true behaves as you would expect.
          The new behavior (for multi-selects) will be as follows:
          - Arrow keys will allow the user to move through rows, highlighting the entries, but not toggling selection
          - Space key will toggle selection
          - Enter key will accept the changes and hide the pick-list
          - Escape key will hide the pickList without accepting the changes.

          We will be applying these changes to mainline (4.1d) and 4.0p only. While we agree the current behavior is not ideal on 3.1p the changes we are making here are somewhat extensive and not very safe to backport to that branch.

          We'll let you know when you can pick up the changes in 4.0p (we're currently doing some final testing, but they should be committed either today or tomorrow, barring anything unexpected)

          Regards
          Isomorphic Software

          Comment


            #6
            Just a follow up to note that this change has been made in the 4.0p and 4.1d branches. Should be present in the next nightly build (July 26 or above)

            Regards
            Isomorphic Software

            Comment

            Working...
            X