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

Add support for "disable-sort" class per column #57

Merged
merged 2 commits into from
May 7, 2022

Conversation

vhtkrk
Copy link
Contributor

@vhtkrk vhtkrk commented May 6, 2022

Resolves #7. And maybe #51 too but I'm not 100% sure if that's what they asked for.

@kyle-wannacott
Copy link
Owner

Hey @vhtkrk

In #51 they are talking about excluding rows from being sorted; whereas this is disabling the sort on the click of columns.

I'm wondering whether this feature should also freeze the column in place, another-words if the user clicks on another column the column that has disable-sort on it should remain in place/ in the original order. Because I can't think of a use case where you would want to disable sorting on the click of a column and yet want it to be sorted when clicking on another column; unless you can? 🤔

However, it may be a bit tricky to implement considering table-sort-js sorts the <tr>.

What are your thoughts? are you up for trying to implement this? 🤔

Thanks.

@kyle-wannacott
Copy link
Owner

kyle-wannacott commented May 6, 2022

Hmmmm after further thought; maybe there is a use case where if a user clicks on a column and it doesn't sort properly; so you want to disable it. Maybe the freezing a column should be a different class. Could you add documentation for disable-sort to public/docs/classes.html and README.md and then I'm happy to merge the feature. Thanks 😺

@vhtkrk
Copy link
Contributor Author

vhtkrk commented May 6, 2022

Thanks for your input.

I actually have a use case for just what I made: I have a bunch of rows where there's either "First name" and "Last name" as separate fields, or just a "Name" field that has both in it. The easiest way to fit in with other requirements was to stuff it into a table with 2 columns: "Name" and another one with an empty heading. Then in a loop I either put the full name in the first column or the first name in the first column and last name in the second. But sorting by that second field was confusing, especially when the column header has no text.

I'll have to see what it would take to freeze the columns so they won't be sorted at all, but that sounds like it's a bit more work than this, so no promises as I don't have immediate use for it myself. But I agree it should be a different feature from this one.

I'll update the docs tomorrow or Sunday if I don't find the time tomorrow.

@kyle-wannacott
Copy link
Owner

I actually have a use case for just what I made

OK cool; I never thought of that use case.

I'll have to see what it would take to freeze the columns

Yeah, I wouldn't worry about freezing the column for this PR; can do that as a separate feature.

I'll update the docs tomorrow or Sunday if I don't find the time tomorrow.

All good, just whenever is convenient 👍

@vhtkrk
Copy link
Contributor Author

vhtkrk commented May 7, 2022

I've updated the documentation. Also added missing remember-sort documentation to public/docs/classes.html and fixed a few typos while I was at it.

@kyle-wannacott kyle-wannacott merged commit c8d4273 into kyle-wannacott:master May 7, 2022
@kyle-wannacott
Copy link
Owner

kyle-wannacott commented May 7, 2022

I've updated the documentation. Also added missing remember-sort documentation to public/docs/classes.html and fixed a few typos while I was at it.

Looks good to me!

Merged in commit: c8d4273 and new release: https://github.com/LeeWannacott/table-sort-js/releases/tag/1.7.9

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

Successfully merging this pull request may close these issues.

Add a tag class for disabling sort on specific table columns.
2 participants