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

sorton example page has incorrect examples #1641

Closed
studgeek opened this issue Mar 22, 2019 · 2 comments
Closed

sorton example page has incorrect examples #1641

studgeek opened this issue Mar 22, 2019 · 2 comments

Comments

@studgeek
Copy link

The sorton documentation on at https://mottie.github.io/tablesorter/docs/index.html properly describes how to call trigger sorton:
$( 'table' ).trigger( 'sorton', [ [[0,0],[2,0]] ] );

However, the examples at https://mottie.github.io/tablesorter/docs/example-trigger-sort.html are missing a wrapping set of square brackets. So it shows examples like the following, which silently fails (even with "debug filter" on).
$("#table1").trigger("sorton", [ [] ]);

Also, the example page does not mention the new direct method added in 2.23.

Perhaps there was a change in 2.23 to add the callback and the example page was not updated?

I'll add, sorton with the old style (as shown in current example page) should really throw an error of some sort (at least when debug: true) since older code may try to use that approach.

@Mottie
Copy link
Owner

Mottie commented Mar 22, 2019

Hi @studgeek!

Hmm, yeah the example $("#table1").trigger("sorton", [ [] ]); is only meant to be a placeholder. It updates when you click on a button to sort the table. The empty sorton doesn't have any sort to apply, so it ignores it. I'm not sure if that really needs to throw an error.

Anyway, I'll update that page to use $("#table1").trigger("sortReset"); instead of an empty sorton call. And I'll add an example of the direct method.

@Mottie
Copy link
Owner

Mottie commented Mar 22, 2019

Updated. Let me know what you think.

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