jquery.tablesorter: buildCollationTable() on first sort, not on load
authorMatmaRex <matma.rex@gmail.com>
Wed, 24 Jul 2013 18:33:24 +0000 (20:33 +0200)
committerTimo Tijhof <krinklemail@gmail.com>
Mon, 29 Jul 2013 18:13:52 +0000 (20:13 +0200)
Since user and site scripts are now loaded after $.ready(), other
scripts may call .tablesorter() before they have done the
tableSorterCollation customizations.

Bug: 51982
Change-Id: I269181169a5e25fbd98eb2acbd9e2e0f45aaaa86

resources/jquery/jquery.tablesorter.js

index 115a49a..aa95ec0 100644 (file)
                                        // Build headers
                                        $headers = buildHeaders( table, sortMsg );
 
-                                       // Grab and process locale settings
+                                       // Grab and process locale settings.
                                        buildTransformTable();
                                        buildDateTable();
-                                       buildCollationTable();
 
                                        // Precaching regexps can bring 10 fold
                                        // performance improvements in some browsers.
                                        function setupForFirstSort() {
                                                firstTime = false;
 
+                                               // Defer buildCollationTable to first sort. As user and site scripts
+                                               // may customize tableSorterCollation but load after $.ready(), other
+                                               // scripts may call .tablesorter() before they have done the
+                                               // tableSorterCollation customizations.
+                                               buildCollationTable();
+
                                                // Legacy fix of .sortbottoms
                                                // Wrap them inside inside a tfoot (because that's what they actually want to be) &
                                                // and put the <tfoot> at the end of the <table>