Mottie / tablesorter

Github fork of Christian Bach's tablesorter plugin + awesomeness ~

Home Page:https://mottie.github.io/tablesorter/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sorton example page has incorrect examples

studgeek opened this issue · comments

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.

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.

Updated. Let me know what you think.