Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Hide repeating text in columns #1469

Closed
aavmurphy opened this issue Oct 20, 2017 · 9 comments
Closed

Feature Request: Hide repeating text in columns #1469

aavmurphy opened this issue Oct 20, 2017 · 9 comments

Comments

@aavmurphy
Copy link
Contributor

aavmurphy commented Oct 20, 2017

I wrote a plugin for this. It hides repeated-text (and it's table cell borders) in vertical columns. Its another way of 'grouping' content together (except that you use that word for something else. Its triggered by a class in the <th>. It works by adding a class to the td

So, a table like

a a a
a a b
a a c
a b a
a b b
b a a

Gets displayed as

a a a
    b
    c
a b a
    b
b a a

Best to get the idea with an example :

https://www.walkingclub.org.uk/walk/
https://www.walkingclub.org.uk/hills/munros/index.shtml

The CSS I use is

    .sp_col_show {
        background-color: white !important;  /* needed because of stripped rows */
        }

    .sp_col_hide {
        visibility: hidden;
        border-top: white !important;
        background-color: white !important; /* needed because of stripped rows */
        }

Thanks for your work. Its greatly appreciated!

@Mottie
Copy link
Owner

Mottie commented Oct 20, 2017

Hi @aavmurphy!

That looks like a great idea! Would you mind sharing the code in a PR or paste it here and I'll add it?

I would probably avoid setting the background color to white because of the different themes, but that can be fixed with css.

@aavmurphy
Copy link
Contributor Author

If you give me some pointers, I'll try and do a PR myself, and then let you format it to your standards

@aavmurphy
Copy link
Contributor Author

Just actually read what you wrote.

I'll tidy it, and PR it

@Mottie
Copy link
Owner

Mottie commented Oct 20, 2017

Cool! And also please include a license statement. This project is under MIT or GPL-2.0, so it would be great if you wanted to use the same or some similar open source license.

@aavmurphy
Copy link
Contributor Author

@Mottie Done. Added a 'same as tablesorter' license.

@Mottie Mottie closed this as completed in e496cbf Dec 13, 2017
@Mottie
Copy link
Owner

Mottie commented Dec 13, 2017

Sorry for taking so long to finally get this done... I had to tweak the code a little to make it work with multiple columns. Check out the demo.

@aavmurphy
Copy link
Contributor Author

wow. great. going to use it now!
i like the way you've made it work for all columns, not just 'from the left'.

@aavmurphy
Copy link
Contributor Author

@Mottie Great. Working. Thanks.

https://www.walkingclub.org.uk/walk/

Tweaked the CSS a little as I don't always use stripping, (and then use Bootstrap's '.table-striped' rather than the zebra widget).

Could zebra be an option?

(Using your doco example)

Click "first name" : "first name" is correct, but "day" isnt vertically-grouped

Shift-click "day" : now "day" is what I was looking for

i.e. could the algorithm always be run on all columns, not just the "sorting-on" ones?

@Mottie
Copy link
Owner

Mottie commented Dec 15, 2017

  1. The zebra widget works best for filtered content, and in this case properly striping the grouped rows. Bootstrap's table stripe using the :nth-child selector which includes hidden rows, so the striping will look odd - try it out in this Bootstrap demo.
  2. I think it is run on all columns, it's just the zebra striping that isn't run; I'll have to look at it again to make sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants