FORMfields, the premiere web framework
Login
Support Home | Knowledge Base | Documentation | Forums | Contact Us
FORMfields v2 Tutorials
FORMfields Lib Tutorials
TableHelpers Tutorials
Tutorial 1: TableHelpers Setup
Tutorial 2: Using TableHelpers
Tutorial 3: Sorting by Column
FORMgen Tutorials
Tutorial 3: Sorting by Column
Example 1 - Enabling Column Sorting
As of TableHelpers v1.1, you can easily enable click-sorting by setting the enableSort property and using loadQuery like:

<?
    $table1 
= new TableSet();
    
$table1->enableSort true;
    
$table1->loadQuery(
        
"SELECT advertiser AS 'The Advertiser',"
            
"clicks AS 'Clicks',"
            
"impressions AS 'Impressions',"
            
"DATE_FORMAT(date, '%b %D') AS 'Day' "
        
"FROM ffce_traffic"
    
);

    echo 
$table1->getTableTag();
?>

Generates:
The Advertiser ClicksSort Descending Impressions Day
www.redgeoff.com
10
100
Mar 7th
www.redgeoff.com
12
78
Mar 8th
www.urshelf.com
40
234
Mar 8th
www.urshelf.com
50
300
Mar 7th
www.mymusicband.com
150
510
Mar 7th
Support | Earn Money
Copyright © 2005-2013 Brain Book Software LLC.
Built with FORMfields, the premiere web framework.