On Tue, Dec 20, 2011 at 6:49 PM, Bergi <a.d.be...@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/jquery.tablesorter.js?revision=105727&view=markup#l738
>
> > 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 mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to