swingx
  1. swingx
  2. SWINGX-35

Sort multiple columns by clicking on headers

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 0.9.0
    • Fix Version/s: None
    • Component/s: Table
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      35

      Description

      I know you can sort multiple columns programmatically, but it would be great if you could sort multiple
      columns in JXTable by clicking on the column headers. By using a modifier key (i.e. control) you could add
      and remove columns to the sort. Some indicator, like a small number, could indicate where the column is
      in the sort order. So you'd end up with an arrow and a small number in each sorted column. If there is only
      one column being sorted, the number is not needed.

        Issue Links

          Activity

          Hide
          kleopatra added a comment -

          not entirely sure if we want/should support it. GlazedLists has some indication,
          anybody knows other examples? Open a discussion in the forum, maybe?

          Thanks
          Jeanette

          Show
          kleopatra added a comment - not entirely sure if we want/should support it. GlazedLists has some indication, anybody knows other examples? Open a discussion in the forum, maybe? Thanks Jeanette
          Hide
          ge0ffrey added a comment -

          For us, this issue is a blocker to remove Glazedlists and use swingx entirely.
          We have tables where each row represents financial budget (last column) and the
          first 3 columns are "What?", "Where?" and "How?". Depending on the task at hand,
          the user sorts them differently (for example how, where what or what, how, where
          or ...).

          The glazed lists implementation is pretty straightforward:

          • The rows are shown by default in the order of the list
            • none of the columns are specifically sorted so none show an icon
          • if you left click once on a column X, it shows an up triangle icon and that
            column is sorted ascendingly.
          • if you left click once again on a column X, it shows a down triangle icon and
            that column is sorted descendingly.
          • if you left click once again on a column X, it shows no icon and that column
            is sorted like it was orginally added (the sorting has been turned off effectively).

          From a new beginning:

          • if you left click once on column X, then left click once on column Y, then
            left click once on column Z, it show a large up triangle icon on X, and a small
            up triangle icon on Y and Z. It is sorted first on X, then on Y then on Z.
          • if you then double left click on column W, it shows a large up triangle icon
            on W, no icon on X and Y and Z. It is sorted on W only.
            So double clicking on a header effectively restarts the multiple column sorting.
          Show
          ge0ffrey added a comment - For us, this issue is a blocker to remove Glazedlists and use swingx entirely. We have tables where each row represents financial budget (last column) and the first 3 columns are "What?", "Where?" and "How?". Depending on the task at hand, the user sorts them differently (for example how, where what or what, how, where or ...). The glazed lists implementation is pretty straightforward: The rows are shown by default in the order of the list none of the columns are specifically sorted so none show an icon if you left click once on a column X, it shows an up triangle icon and that column is sorted ascendingly. if you left click once again on a column X, it shows a down triangle icon and that column is sorted descendingly. if you left click once again on a column X, it shows no icon and that column is sorted like it was orginally added (the sorting has been turned off effectively). From a new beginning: if you left click once on column X, then left click once on column Y, then left click once on column Z, it show a large up triangle icon on X, and a small up triangle icon on Y and Z. It is sorted first on X, then on Y then on Z. if you then double left click on column W, it shows a large up triangle icon on W, no icon on X and Y and Z. It is sorted on W only. So double clicking on a header effectively restarts the multiple column sorting.
          Hide
          kleopatra added a comment -

          depends on what goes for "pretty straightforward" - last time I looked
          GlazedLists had 3+ pluggable strategies for multiple-sort user interaction

          Actually, Swing/X does multiple column sort by default, the deficits are

          • not intuitve: to have columns X/Y/Z as primary/secondary/tertiary sorted
            column you have to click them in sequence Z/Y/X
          • no visual feedback on the no-primary sort column

          no news, we already discussed it, in the thread you started last december:

          http://forums.java.net/jive/thread.jspa?messageID=377373

          The most tricky part still is the hook of a custom mouse handler on the
          tableHeader - no easy way that I know of (and feeling bad already about the
          little interference we are doing in our header, to allow column packs).

          If you feel like experimenting, would love to see your results

          CU
          Jeanette

          Show
          kleopatra added a comment - depends on what goes for "pretty straightforward" - last time I looked GlazedLists had 3+ pluggable strategies for multiple-sort user interaction Actually, Swing/X does multiple column sort by default, the deficits are not intuitve: to have columns X/Y/Z as primary/secondary/tertiary sorted column you have to click them in sequence Z/Y/X no visual feedback on the no-primary sort column no news, we already discussed it, in the thread you started last december: http://forums.java.net/jive/thread.jspa?messageID=377373 The most tricky part still is the hook of a custom mouse handler on the tableHeader - no easy way that I know of (and feeling bad already about the little interference we are doing in our header, to allow column packs). If you feel like experimenting, would love to see your results CU Jeanette
          Hide
          ge0ffrey added a comment -

          1) - not intuitve: to have columns X/Y/Z as primary/secondary/tertiary sorted
          column you have to click them in sequence Z/Y/X

          This isn't that much of a problem if 2) is fixed. It's just a matter of
          educating our users. JIRA acts this way too and it's debatable if the
          glazedlists way is actually better.

          2) - no visual feedback on the no-primary sort column

          This is why I presumed it did not sort. This is the real issue for me.
          Isn't the default header rendered with a label? Can't we just do
          label.setIcon(ascendingIcon) and label.setHorizontalTextPosition(LEFT).
          The ascendingIcon is just like the column picker icon above the scrollbar (which
          is also LAF independent I believe).

          Show
          ge0ffrey added a comment - 1) - not intuitve: to have columns X/Y/Z as primary/secondary/tertiary sorted column you have to click them in sequence Z/Y/X This isn't that much of a problem if 2) is fixed. It's just a matter of educating our users. JIRA acts this way too and it's debatable if the glazedlists way is actually better. 2) - no visual feedback on the no-primary sort column This is why I presumed it did not sort. This is the real issue for me. Isn't the default header rendered with a label? Can't we just do label.setIcon(ascendingIcon) and label.setHorizontalTextPosition(LEFT). The ascendingIcon is just like the column picker icon above the scrollbar (which is also LAF independent I believe).
          Hide
          kleopatra added a comment -

          tradionally whacky to try and hack into core default header renderers - just look what
          we had to do in the 1.5 versions Don't want to go that path ever again. What I tried
          is to experiment with Dave's suggestion: add a small triangle as unicode char (see JXTableVisualCheck)

          • the outcome is "not necessarily pretty, just as he warned.

          Play a bit, if you like, and let me know what you think (best in the forum discussion)

          Thanks
          Jeanette

          Show
          kleopatra added a comment - tradionally whacky to try and hack into core default header renderers - just look what we had to do in the 1.5 versions Don't want to go that path ever again. What I tried is to experiment with Dave's suggestion: add a small triangle as unicode char (see JXTableVisualCheck) the outcome is "not necessarily pretty, just as he warned. Play a bit, if you like, and let me know what you think (best in the forum discussion) Thanks Jeanette

            People

            • Assignee:
              Unassigned
              Reporter:
              countfloyd
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: