#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2009
    Posts
    676
    Rep Power
    7

    Adjust default sort for a table


    Hey all. I'm not really a JavaScript person, but am trying to help a friend with a little something. This page offers a table, in which, you can click either header to sort column by. Everything works. We just need a little help in knowing what we'd be looking for to alter how the page loads by default. Currently sorting alphabetically, we wish to load sorting by rank. I've looked through all the PHP, and have found some defaults in a .js file, but not what needed.

    The site is http://ancientredemption.jtgcomputers.com/ and the component spoken of is the Guild Roster on left, know as com_raidplanner. The 3 .js files in use are:
    Folder: components/com_raidplanner/
    HtmlTable.Extended.js
    mootools.more.125.additional.js
    raidplanner.js

    Any help/input is greatly appreciated. Thank you.
    .
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4304
    It seems to be using the script's default. You need to set the sortIndex and maybe the sortReverse properties in the embedded script.
    Code:
    var rosterTable = new HtmlTable(
    	$('roster_table'),
    	{
    		properties: {
    			border: 0,
    			cellspacing: 1,
    			cellpadding: 5
    		},
    		sortable: true,
    		sortIndex: 5,
    		zebra: true,
    		selectable: true,
    		allowMultiSelect: false,
    [...]
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo