Tablesorter
From zen2
For tablesorter plugin the script must run at page load, therefore the script must be in the header. To achieve this make a .js which includes the script to execute on load for this specific table, and save it in the jquery plugins folder.
Example file - tableloader-d9.js
$(document).ready(function() { // call the tablesorter plugin $("table").tablesorter({ headers: { 3: { sorter:'currency' }, 4: { sorter:'currency' }, 8: { sorter:'currency' }, 9: { sorter:'currency' }, 10: { sorter:'currency' }, 11: { sorter:'currency' }, 12: { sorter:'currency' } } }); });
Add the second line at the top:
require_once(PATH_tslib.'class.tslib_pibase.php'); require_once(t3lib_extMgm::extPath("jquery")."class.tx_jquery.php");
Add the last 2 lines here:
function main($content,$conf) { $this->conf=$conf; $this->pi_setPiVarDefaults(); $this->pi_loadLL(); tx_jquery::setPlugins(array('iutil','jquery.tablesorter','tableloader-xxx')); tx_jquery::includeLib();
where tableloader-xxx is the name of the load script you created.
To use:
You must use thead and th
$content .= '<table class="datatable">'; $content .= '<thead><tr><th width="120"><h3>Date</h3></th>.....</thead> <tbody> . . . </tbody> </table>
Scripts inside the table may cause malfunctions.