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

Doesn't sort properly... #192

Open
FlashT opened this issue Feb 7, 2018 · 4 comments
Open

Doesn't sort properly... #192

FlashT opened this issue Feb 7, 2018 · 4 comments

Comments

@FlashT
Copy link

FlashT commented Feb 7, 2018

http://193.70.114.83/wrong.png

@joequery
Copy link
Owner

joequery commented Feb 7, 2018

Hi there!

Can you please send over the HTML you used for your example? It's much easier to replicate from a gist or a JSfiddle than an image.

@FlashT
Copy link
Author

FlashT commented Feb 8, 2018

It can't handle colspan properly. Any table with colspan before the sortable column in any row will make it either crash (syntax error: "Cannot read property 'toString' / 'parseFloat' / 'parseInt' of undefined") or give wrong order.

I think it needs to fix the indexes in such a situation. In my case I just needed to keep the row with colspan at the end, so edited plugin code a bit, but still... as above.

@joequery
Copy link
Owner

joequery commented Feb 8, 2018

I'm glad you were able to resolve the issue! What was the adjustment you made to the plugin?

@FlashT
Copy link
Author

FlashT commented Feb 8, 2018

I just added a "dontsort" class to my row with colspan, changed line 140 of plugin code to:

var trs = $table.children("tbody").children("tr").not('.dontsort');

and changed line 111, so it would prepend instead of appending (so my row with colspan would stay last after sorting):

$table.children("tbody").prepend(trs);

Please note, that it's only a solution for my case, when last row (containing colspan) may not be sorted... but has to stay at the end of the table then.

But I think the easiest way to fix the colspan sorting problem is to modify stupidtable_build() function a bit... so it would get proper elements from column... to something like in this project.

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

No branches or pull requests

2 participants