WordPress.org

Ready to get started?Download WordPress

Forums

ULTIMATE TABLES
Sort table by first column descendent (7 posts)

  1. erickva
    Member
    Posted 1 year ago #

    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/

  2. Deetimba
    Member
    Posted 1 year ago #

    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

  3. Deetimba
    Member
    Posted 1 year ago #

    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

  4. just1n
    Member
    Posted 1 year ago #

    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

  5. dexter666
    Member
    Posted 1 year ago #

    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" ]]
  6. just1n
    Member
    Posted 1 year ago #

    Dude, thanks a million! Worked like a charm.

  7. ashishverma.pu
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic