ICEfaces
  1. ICEfaces
  2. ICE-3741

Add support for using mouse click + "shift" and "ctrl" keys to select multiple rows in dataTable

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.8RC1, 1.8
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      ANY
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      You might want to achieve this feature on the application level as a workaround. For example, you could have a selectManyMenu component with row identifiers as options. then you could perform mouse click + "shift" key operation to select multiple options and then reflect them to the actual dataTable with ice:rowSelector component.
      Show
      You might want to achieve this feature on the application level as a workaround. For example, you could have a selectManyMenu component with row identifiers as options. then you could perform mouse click + "shift" key operation to select multiple options and then reflect them to the actual dataTable with ice:rowSelector component.

      Description

      when use rowselecting dataTable, we could select a row and press "shift" key then select another row then all rows in between will be selected.

        Issue Links

          Activity

          Hide
          Joanne Bai added a comment -

          QA used JSP component-showcase and verified the fix again on ICEfaces trunk revision 18864

          Show
          Joanne Bai added a comment - QA used JSP component-showcase and verified the fix again on ICEfaces trunk revision 18864
          Hide
          Mandeep Hayher added a comment -

          Tested successfully on ICEFaces1.8 RC1 build2, jsp version component-showcase on tomcat5 server (windows machine).

          Show
          Mandeep Hayher added a comment - Tested successfully on ICEFaces1.8 RC1 build2, jsp version component-showcase on tomcat5 server (windows machine).
          Hide
          Adnan Durrani added a comment -

          Hi Krashan Brahmanjara,

          Sorry to say that you have got some misunderstanding, there are only two hidden fields added per table, not per row.

          Thanks,
          Adnan

          Show
          Adnan Durrani added a comment - Hi Krashan Brahmanjara, Sorry to say that you have got some misunderstanding, there are only two hidden fields added per table, not per row. Thanks, Adnan
          Hide
          Ken Fyten added a comment -

          Confirmed that the Mac Command key is working as expected.

          Show
          Ken Fyten added a comment - Confirmed that the Mac Command key is working as expected.
          Hide
          Krashan Brahmanjara added a comment -

          I see that on every row you add two hidden inputs. I suppose that better solution will be enabling this part of code only if multiselect is enabled.
          if (rowSelectorFound) {
          > if (rowSelector.isEnhancedMultiple())

          { Element ctrlKeyEle = domContext.createElement(HTML.INPUT_ELEM); ctrlKeyEle.setAttribute(HTML.TYPE_ATTR, "hidden"); ctrlKeyEle.setAttribute(HTML.ID_ATTR, paramId + "ctrKy"); ctrlKeyEle.setAttribute(HTML.NAME_ATTR, paramId + "ctrKy"); Element shiftKeyEle = domContext.createElement(HTML.INPUT_ELEM); shiftKeyEle.setAttribute(HTML.TYPE_ATTR, "hidden"); shiftKeyEle.setAttribute(HTML.ID_ATTR, paramId + "sftKy"); shiftKeyEle.setAttribute(HTML.NAME_ATTR, paramId + "sftKy"); tBody.appendChild(ctrlKeyEle); tBody.appendChild(shiftKeyEle); > }

          Also instead hidden inputs javasript array can be used. But this is feature request only for performance issues.

          Show
          Krashan Brahmanjara added a comment - I see that on every row you add two hidden inputs. I suppose that better solution will be enabling this part of code only if multiselect is enabled. if (rowSelectorFound) { > if (rowSelector.isEnhancedMultiple()) { Element ctrlKeyEle = domContext.createElement(HTML.INPUT_ELEM); ctrlKeyEle.setAttribute(HTML.TYPE_ATTR, "hidden"); ctrlKeyEle.setAttribute(HTML.ID_ATTR, paramId + "ctrKy"); ctrlKeyEle.setAttribute(HTML.NAME_ATTR, paramId + "ctrKy"); Element shiftKeyEle = domContext.createElement(HTML.INPUT_ELEM); shiftKeyEle.setAttribute(HTML.TYPE_ATTR, "hidden"); shiftKeyEle.setAttribute(HTML.ID_ATTR, paramId + "sftKy"); shiftKeyEle.setAttribute(HTML.NAME_ATTR, paramId + "sftKy"); tBody.appendChild(ctrlKeyEle); tBody.appendChild(shiftKeyEle); > } Also instead hidden inputs javasript array can be used. But this is feature request only for performance issues.
          Hide
          Adnan Durrani added a comment -

          Doc added :
          svn\ossrepo\icefaces\trunk\icefaces\component\doc\tableRowSelectionDoc.html
          Trunk: revision 18202

          Show
          Adnan Durrani added a comment - Doc added : svn\ossrepo\icefaces\trunk\icefaces\component\doc\tableRowSelectionDoc.html Trunk: revision 18202
          Hide
          Adnan Durrani added a comment -

          Mac key support added.

          Trunk: revision 18201

          Show
          Adnan Durrani added a comment - Mac key support added. Trunk: revision 18201
          Hide
          Ken Fyten added a comment -

          Also need to add this new feature the Description page (comp. showcase) for this component.

          Show
          Ken Fyten added a comment - Also need to add this new feature the Description page (comp. showcase) for this component.
          Hide
          Ken Fyten added a comment -

          Need to add support for the Mac "Command" key to be used instead of the CTRL key (same functionality).

          Here is a reference to the relevant keycodes, etc.: http://unixpapa.com/js/key.html

          Note the section that states:

          "On keydown and keyup, the event objects also have flags that indicate which modifier keys were being pressed when the key was typed. These are:

          event.shiftKey
          event.ctrlKey
          event.altKey
          event.metaKey

          These all have true or false values. According to the DOM 3 standard, on the Macintosh, the Option key should activate event.altKey and the Command key should activate event.metaKey. These attributes seem to work correctly on all modern browsers tested, except event.metaKey is undefined in all versions IE. There is some freakishness in obsolete browsers that can probably be ignored these days. In Macintosh versions of IE, the Command key sets event.ctrlKey and the Control key does nothing. In Netscape 4, none of these attributes existed and the event.modifiers attribute needed to be used instead."

          Show
          Ken Fyten added a comment - Need to add support for the Mac "Command" key to be used instead of the CTRL key (same functionality). Here is a reference to the relevant keycodes, etc.: http://unixpapa.com/js/key.html Note the section that states: "On keydown and keyup, the event objects also have flags that indicate which modifier keys were being pressed when the key was typed. These are: event.shiftKey event.ctrlKey event.altKey event.metaKey These all have true or false values. According to the DOM 3 standard, on the Macintosh, the Option key should activate event.altKey and the Command key should activate event.metaKey. These attributes seem to work correctly on all modern browsers tested, except event.metaKey is undefined in all versions IE. There is some freakishness in obsolete browsers that can probably be ignored these days. In Macintosh versions of IE, the Command key sets event.ctrlKey and the Control key does nothing. In Netscape 4, none of these attributes existed and the event.modifiers attribute needed to be used instead."
          Hide
          Adnan Durrani added a comment -

          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\bridge\lib\extras\extras.js
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\RowSelector.java
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\RowSelectorEvent.java
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\renderkit\TableRenderer.java
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-rowselector-props.xml
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-src\org\icefaces\application\showcase\view\bean\examples\component\rowSelector\RowSelectController.java
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-src\org\icefaces\application\showcase\view\resources\messages_en.properties
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-src\org\icefaces\application\showcase\view\resources\messages_es.properties
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-web\WEB-INF\includes\examples\custom\dataTable-rowSelection.jspx
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\RowSelectorEvent.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-src\org\icefaces\application\showcase\view\resources\messages_es.properties
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-src\org\icefaces\application\showcase\view\bean\examples\component\rowSelector\RowSelectController.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-web\WEB-INF\includes\examples\custom\dataTable-rowSelection.jspx
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-rowselector-props.xml
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\bridge\lib\extras\extras.js
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\renderkit\TableRenderer.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-src\org\icefaces\application\showcase\view\resources\messages_en.properties
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\RowSelector.java
          Completed: At revision: 18168

          Show
          Adnan Durrani added a comment - Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\bridge\lib\extras\extras.js Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\RowSelector.java Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\RowSelectorEvent.java Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\renderkit\TableRenderer.java Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-rowselector-props.xml Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-src\org\icefaces\application\showcase\view\bean\examples\component\rowSelector\RowSelectController.java Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-src\org\icefaces\application\showcase\view\resources\messages_en.properties Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-src\org\icefaces\application\showcase\view\resources\messages_es.properties Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-web\WEB-INF\includes\examples\custom\dataTable-rowSelection.jspx Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\RowSelectorEvent.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-src\org\icefaces\application\showcase\view\resources\messages_es.properties Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-src\org\icefaces\application\showcase\view\bean\examples\component\rowSelector\RowSelectController.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-web\WEB-INF\includes\examples\custom\dataTable-rowSelection.jspx Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-rowselector-props.xml Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\bridge\lib\extras\extras.js Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\renderkit\TableRenderer.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\samples\component-showcase\common-src\org\icefaces\application\showcase\view\resources\messages_en.properties Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\RowSelector.java Completed: At revision: 18168
          Hide
          Adnan Durrani added a comment -

          revision: 18168

          New enhancedMultiple boolean attribute added. When true, it offers following selection behaviour:

          • "Click" selects clicked row and deselects rest
          • "Click + Ctrl" flip the selection of clicked row and keeps previous selection intact
          • "Click + Shift" selects all rows from last clicked row to newly clicked row, and deselect rest
          • "Click + Shift + Ctrl" selects all rows from last clicked row to newly clicked row and keeps previous selection intact
          Show
          Adnan Durrani added a comment - revision: 18168 New enhancedMultiple boolean attribute added. When true, it offers following selection behaviour: "Click" selects clicked row and deselects rest "Click + Ctrl" flip the selection of clicked row and keeps previous selection intact "Click + Shift" selects all rows from last clicked row to newly clicked row, and deselect rest "Click + Shift + Ctrl" selects all rows from last clicked row to newly clicked row and keeps previous selection intact
          Hide
          Mark Collette added a comment -

          java.awt.List has these two methods, showing their later addition of supporting multiple selection
          int getSelectedIndex()
          int[] getSelectedIndexes()

          We should probably follow a similar approach, and have clickedRow:int and clickRows:int[]

          Show
          Mark Collette added a comment - java.awt.List has these two methods, showing their later addition of supporting multiple selection int getSelectedIndex() int[] getSelectedIndexes() We should probably follow a similar approach, and have clickedRow:int and clickRows:int[]
          Hide
          Paul van Rossem added a comment -
          Show
          Paul van Rossem added a comment - See also http://jira.icefaces.org/browse/ICE-2001

            People

            • Assignee:
              Unassigned
              Reporter:
              Sam Xiao
            • Votes:
              6 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: