Extension:SortableTable

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
SortableTable

Release status: unknown

Implementation Tag, Skin
Description
Download here
Example working example

This extension is based on the sortable table Javascript by WebFX.

Contents

[edit] Working Example and Latest Updates

You can see a working example and download the the latest code here.

[edit] Installation

[edit] Javascripts

You must install the WebFX javascript files in an accessable dir, ('/skins/common/js/' is good) , and create links to them in your skin files like Monobook.php.

 <script type="text/javascript" src="<?php $this->text('stylepath' ) ?>/common/js/sortabletable.js"></script>
 <link type="text/css" rel="StyleSheet" href="<?php $this->text('stylepath' )?>/common/css/sortabletable.css" />
 

[edit] CSS

Add the CSS from the WebFX Javascript site to the Mediawiki:Monobook.css message OR directly to your CSS file.

[edit] LocalSettings.php

Add include("extensions/SortableTableExtension.php"); near the bottom of your LocalSettings.php file, where you install all your extensions.

[edit] Usage

The SortableTable Extension uses an XML style table syntax. Mostly because I didn' bother to find out why MediaWiki trashed all of the <table>, <tbody> and other real html tags. There was no problem with the made up XML style tags. I hate the MediaWiki Table Syntax so I don't support it. ;P

[edit] Example Sorttable Wiki Markup

<sorttable>
<tablehead>
 <row>
   <cell sort="string">String</cell>
   <cell>Default</cell>
   <cell sort="number">Number</cell>
   <cell sort="Date">Date</cell>
   <cell sort="None">No Sort</cell>
   <cell>Default</cell>
 </row>
</tablehead>
<tablebody>
 <row style="background: cyan;">
   <cell>http://maps.google.com</cell>
   <cell>S</cell>
   <cell>10</cell>
   <cell>2001-09-11</cell>
   <cell>[[Item 0]]</cell>
   <cell>1</cell>
 </row>
 <row style="background: silver;">
   <cell>http://froogle.google.com</cell>
   <cell>a</cell>
   <cell class="highlight">20</cell>
   <cell>2006-02-03</cell>
   <cell>[[Item 1| Test Item #1]]</cell>
   <cell>2</cell>
 </row>
 <row>
   <cell>[http://google.com Google]</cell>
   <cell>z</cell>
   <cell>30</cell>
   <cell>2002-03-23</cell>
   <cell>[[Item 2]]</cell>
   <cell>10</cell>
 </row>
 <row>
   <cell>four</cell>
   <cell>B</cell>
   <cell>40</cell>
   <cell>2007-02-03</cell>
   <cell>[[Item 3]]</cell>
   <cell>5</cell>
 </row>
</tablebody>
</sorttable>

[edit] Code

The SortableTableExtension.php code is available here.

Personal tools