1. Go to this page and download the library: Download tomkirsch/sorter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tomkirsch / sorter example snippets
$qt = $sorter->quickTable('foo') // pass the table name, or you can omit for only 1 table
// define your columns and how you'd like the values to be formatted...
// simple
->addCol('customer_id', 'Customer Number')
// template with variable substitution
->addCol('customer_address', 'Address', 'asc', '$customer_address<br>$customer_city')
// typical formats
->addCol('iscash', 'Cash', 'desc', 'yesno')
->addCol('amount', 'Amount', 'desc', 'money')
->addCol('balance', 'Balance', 'desc', 'balance') // negative values are shown with parentheses
->addCol('widgetcount', '# of Widgets', 'desc', 'number') // number with grouped thousands
->addCol('ph_level', 'pH', 'desc', 'number|1') // 1 decimal place (arguments separated by pipe)
->addCol('created', 'Created', 'desc', 'datetime')
->addCol('thetime', 'Time', 'desc', 'time')
->addCol('schedule', 'Sched Date', 'desc', 'dateFormat|D m/d') // custom date format (arguments separated by pipe)
// closure (most flexible - however you MUST return TD tags)
->addCol('customer_iscash', 'Cash', 'desc', function($value, $row){
return '<td class="bg-success">'.($value ? 'Yes' : 'No').'</td>';
})
// you can also define a closure for the opening <tr> tag:
->rowTemplate(function($row){
return '<tr data-foobar="'.$row->id.'">';
})
;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.