FANDOM


Line 5: Line 5:
 
then each column header needs a data-sort-type attribute, which is probably going to be "number".
 
then each column header needs a data-sort-type attribute, which is probably going to be "number".
   
<nowiki>{| class="wikitable sortable"<br/>
+
<nowiki>{| class="wikitable sortable"</nowiki>
! data-sort-type="number" | A<br/>
+
<nowiki> ! data-sort-type="number" | A</nowiki>
! data-sort-type="number" | B<br/>
+
<nowiki> ! data-sort-type="number" | B</nowiki>
...rows...<br/>
+
<nowiki> ...rows...</nowiki>
|}</nowiki>
+
<nowiki> |}</nowiki>
   
 
[//community.wikia.com/wiki/Help:Sorting http://community.wikia.com/wiki/Help:Sorting]
 
[//community.wikia.com/wiki/Help:Sorting http://community.wikia.com/wiki/Help:Sorting]

Revision as of 00:47, December 1, 2018

You don't have to write any code, it's all already done by javascript included with wikia. You need to add "sortable" to the table class list, like this:

{| class="wikitable sortable"

then each column header needs a data-sort-type attribute, which is probably going to be "number".

{| class="wikitable sortable" ! data-sort-type="number" | A ! data-sort-type="number" | B ...rows... |}

http://community.wikia.com/wiki/Help:Sorting

Community content is available under CC-BY-SA unless otherwise noted.