Support » Plugin: ULTIMATE TABLES » Sort table by first column descendent

  • Hi,

    Excellent plugin!

    Is it possible to sort a table automatically once it is loaded?
    I number my rows as 1, 2, 3, 4, and so on. But I’d like to show the last added row first. If I click on the column I can easily reorder, very good. But it can be a challenge for the users.
    How can I load the table already sorted by given column descendent?

    Regards,
    Erick

    http://wordpress.org/extend/plugins/ultimate-tables/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi everyone,

    same same here. But first: good stuff and nice implementation of datatables.net (http://goo.gl/XPqFM).

    I installed the plugin yesterday and want to sort by date (YYYY-MM-DD, desc order). I have not found a way on how to do it. So I would really appreciate any help on how I can change the sorting on single tables .

    Thanks, Tim

    Well,

    I found the parameter which changes sort order by date in the format YYYY-MM-DD, just add the following (assuming you have 3 columns) to the init.php after line 210:

    "aoColumns": [
            {"sType": "date-euro"},
            {"bSortable": true},
    	{"bSortable": true}
    		]

    To change alphabetical sorting just replace
    {"sType": "date-euro"},
    with
    { "asSorting": [ "desc" ] },

    Hope that helps. You can find more info here: http://www.datatables.net/usage/columns. Notice that changes in init.php apply to all tables you create using the plugin.

    Cheers,
    Tim

    Thanks Tim, I tried to copy/paste the code you posted but it didn’t fix the issue and it seems that line 210 isn’t the right place to place the code.

    Can you just confirm what the line before it should be, or maybe just screenshot yours as an example?

    Thanks in advance!

    best,
    Justin

    Hi,

    had the same problem, trying to sort the output.
    Found a simple solution without changing the php.ini.
    It’s also possible to change the output for each single table.

    Just go to the bottom of your ultimate table:

    "oLanguage": {
    		"sLengthMenu": "Display _MENU_ records per page",
    		"sZeroRecords": "Nothing found - sorry",
    		"sInfo": "Showing _START_ to _END_ of _TOTAL_ records",
    		"sInfoEmpty": "Showing 0 to 0 of 0 records",
            	"sSearch": "Search: ",
    		"sInfoFiltered": "(filtered from _MAX_ total records)"
    	}

    and add following in a new line at the end (for a table with 5 columns):

    "aaSorting": [[ 5, "desc" ]]

    will look like this:

    "oLanguage": {
    		"sLengthMenu": "Display _MENU_ records per page",
    		"sZeroRecords": "Nothing found - sorry",
    		"sInfo": "Showing _START_ to _END_ of _TOTAL_ records",
    		"sInfoEmpty": "Showing 0 to 0 of 0 records",
            	"sSearch": "Search: ",
    		"sInfoFiltered": "(filtered from _MAX_ total records)"
    	},
    
    "aaSorting": [[ 5, "desc" ]]

    Dude, thanks a million! Worked like a charm.

    dexter666,
    Thanks a lot buddy.
    but that didn’t .. it removed all other features seach and mannual sortin !! 🙁

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Sort table by first column descendent’ is closed to new replies.