
01-28-2010, 01:47 PM
|
 |
Member
|
|
Join Date: Nov 2009
Posts: 32
|
|
Code:
//Will Sort alpahbetically by title, and hide the headings.
tableSort = function (page) {
if ( $j(".ecwid-productBrowser-productsTable-table").length ) { //Is table there?
$j(".ecwid-productBrowser-productsTable-table colgroup").remove();
if ( $j(".ecwid-productBrowser-productsTable-table thead").length ) {
$j('.ecwid-productBrowser-productsTable-table').trigger("update");
var sorting = [[1,0]];
$j("table").trigger("sorton",[sorting]);
return true;
} else {
$j('.ecwid-productBrowser-productsTable-table').prepend("<thead style='display: none;'><tr><th>SKU</th><th>NAME</th><th>PRICE</th><th>BUY</th></tr></thead>")
$j.tablesorter.addParser({
id: 'productID',
is: function(s) {
return false;
},
format: function(s) {
k = s.replace(/(<([^>]+)>)/ig,"");
return k;
},
type: 'text'
});
$j('.ecwid-productBrowser-productsTable-table').tablesorter({
headers: {
1: {
sorter:'productID',
}
}, sortList: [[1,0]]
});
return true;
}
} else return false;
}
addMod(tableSort, "category");
add this to your <head>
Code:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>
<script src="http://www.ciedesign.co.uk/temp/ecwidMods.js" type="text/javascript"></script>
<script src="http://www.ciedesign.co.uk/temp/tablesorter/jquery.tablesorter.js" type="text/javascript"></script>
<script src="http://www.ciedesign.co.uk/temp/tableSort.js" type="text/javascript"></script>
The bottom one can be modified and uploaded to your server if you want to modify it.
DEMO
Last edited by craig.cooper; 01-28-2010 at 02:10 PM.
Reason: Actually works now
|