Now that skins/common/wikibits.js is gone, so is the function ts_makeSortable. What is the equivalent call to ts_makeSortable(table) in MediaWiki 1.18?
Here is our code we need to convert:
function makesortable( context ) { $('table.sortable', context) .each(function(index, table){ if (!$(table).find('th a span.sortarrow').length) { ts_makeSortable(table); } }); }
This is from an extension that sorts a table by a specified column when the page is rendered.
Thank you. DanB
Daniel Barrett schrieb:
Now that skins/common/wikibits.js is gone, so is the function ts_makeSortable. What is the equivalent call to ts_makeSortable(table) in MediaWiki 1.18?
The tablesorter is available as a jQuery plugin function, see http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/resources/jquery/jque...
Here is our code we need to convert:
function makesortable( context ) { $('table.sortable', context) .each(function(index, table){ if (!$(table).find('th a span.sortarrow').length) { ts_makeSortable(table); } }); }
This is from an extension that sorts a table by a specified column when the page is rendered.
I'd propose $('table.sortable:not(.jquery-tablesorter)').tablesorter();
Bergi
On Tue, Dec 20, 2011 at 6:49 PM, Bergi a.d.bergi@web.de wrote:
Daniel Barrett schrieb:
Now that skins/common/wikibits.js is gone, so is the function
ts_makeSortable. What is the equivalent call to ts_makeSortable(table) in MediaWiki 1.18?
The tablesorter is available as a jQuery plugin function, see
http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/resources/jquery/jque...
Here is our code we need to convert:
function makesortable( context ) { $('table.sortable', context) .each(function(index, table){ if (!$(table).find('th a span.sortarrow').length) { ts_makeSortable(table); } }); }
This is from an extension that sorts a table by a specified column when
the page is rendered.
I'd propose $('table.sortable:not(.jquery-tablesorter)').tablesorter();
Bergi
Please keep in mind that if your "table" is outputted by PHP and thus in the document before the document ready event, MediaWiki standard JavaScript will pick it up and apply the jQuery tablesorter plugin for you, do not apply it again!
You only need to call .tablesorter() yourself on elements that you inserted through AJAX or for other reasons are not covered by $( 'table.sortable' ) at document ready.
Krinkle
wikitech-l@lists.wikimedia.org