Support » Plugin: ULTIMATE TABLES » How To Make Data Display in Reverse Order

  • Hello,

    I installed the ULTIMATE TABLES Plugin. I would like the plugin to be displaying the data from the very last input to the first.

    For instance,

    DATA ENTERED IN PLUGIN IN ADMIN
    1. Apple
    2. Bean
    3. Yam
    4. Zebra

    DATA TO BE DISPLAYED OUTPUT ON PAGE

    4. Zebra
    3. Yam
    3. Bean
    1. Apple

    ____________________________

    Please how do I do this with this plugin. I have searched everyone on how to do it. Thanks for your prompt response.

    https://wordpress.org/plugins/ultimate-tables/

Viewing 1 replies (of 1 total)
  • I faced on a similar problem :
    On first display, to sort descending
    To keep sorting by click on column header

    I failed by use of javascript datatables parameter “aoColumnDefs”: [ { "asSorting": [ "desc", "asc" ], "aTargets": [ 0 ] } ] . It seems that the runtime layer forces an ascending sort after this instruction …
    The workaround I used with success on my side is:
    to add a column ‘Number’ which contains values in a reverse order than the column I want to sort descending.
    To add javascript code in the ultimate-tables/init.php file, with the WordPress Edit Plugin Editor.
    In the default sequence :

    <script type="text/javascript" charset="utf-8">
     jQuery(document).ready(function() {
        jQuery(\'#table_'.$id.$contador.'\').DataTable( {"destroy": true,"bPaginate": '.$ispagination.',"bLengthChange": '.$op5.',"bFilter": '.$op1.',"bSort": '.$op2.',"bInfo": '.$op3.',"bStateSave": true,"bAutoWidth": '.$sizedescription.',"sPaginationType": "'.$typepagination.'",'.$heighttable.''.$sizetitle.'} );
    });

    I added
    ,"aoColumnDefs": [{ "bVisible": false, "aTargets": [ 0 ] }, { "iDataSort": 0, "aTargets": [ 1 ] }]
    The new column ‘Number’ is column 0 and I hide it; Values of column 0 are used to sort the target, column 1.

    The new sequence is now

    <script type="text/javascript" charset="utf-8">
     jQuery(document).ready(function() {
        jQuery(\'#table_'.$id.$contador.'\').DataTable( {"destroy": true,"bPaginate": '.$ispagination.',"bLengthChange": '.$op5.',"bFilter": '.$op1.',"bSort": '.$op2.',"bInfo": '.$op3.',"bStateSave": true,"bAutoWidth": '.$sizedescription.',"sPaginationType": "'.$typepagination.'",'.$heighttable.''.$sizetitle.',"aoColumnDefs": [{ "bVisible": false, "aTargets": [ 0 ] }, { "iDataSort": 0, "aTargets": [ 1 ] }]} );
    });

    It’s probably not the most elegant manner, but it works …

Viewing 1 replies (of 1 total)
  • The topic ‘How To Make Data Display in Reverse Order’ is closed to new replies.