As previously announced via banners and our newsletters, support is no longer available through this platform.

For easier navigation, you can still click on "Submit a Ticket" here, choose the appropriate category, and you'll be redirected to the correct support channel for your plugin.

You can still access your previous tickets and browse public tickets, but please note that responding to tickets is no longer possible.

Paid customers: Please log in to your store account for support.

Pre-purchase questions: Use the support widget in the bottom-right corner of our websites:
https://wpamelia.com
https://wpdatatables.com
https://wpreportbuilder.com

Okay
  Public Ticket #935130
Make select columns unsortable
Closed

Comments

  •  2
    sllow88 started the conversation

    Hello!

    I have just acquired Wpdatatables, but I'm having some issues:

    1. Is there a way to make only some columns unsortable on a table? Specifically I need to make columns 0 and 3 unsortable.

    2. Is there a way to have  no displayed header on a column? I tried erasing it on "Optional column setup" but when saving the header "title" comes back.

    3. Is there a way to get rid of the vertical innner borders of all tables? I tried using some custom CSS, but had no luck.


    Thanks!

  • [deleted] replied

    Hi sllow88,
    Thank you for your purchase.

    1. You can add this code on page where your table is located:

    <script>
    jQuery(function(){
        jQuery(document).ready(function(){
            wpDataTables.table_1.fnSettings().aoColumns[0].bSortable = false;
            wpDataTables.table_1.fnSettings().aoColumns[2].bSortable = false;
        });
    });
    </script>
    

    2. It is not possible if you remove column header, but it can be done with CSS or little jQuery snippet.

    3. Please send me a link of your table so I can take a look. And please specify me what borders you want to remove.

  •   sllow88 replied privately
  • [deleted] replied

    Hi sllow88,

    I have sorting enabled on my table but would like to have a "Show featured items first" on my table like the one on http://www.money.co.uk/loans.htm
    -Unfortunately this feature is not available out of the box, and it can be done just with some custom coding.

  •   sllow88 replied privately
  •  2
    sllow88 replied

    I have found the following code on datatables forum https://datatables.net/forums/discussion/4866/sorting-on-multiple-columns

    $(document).ready(function() {
    var oTable = $('#tablehtml').dataTable();
    $('#tablehtml thead th:eq(2)').unbind('click').click(function(){
    var aaSorting = oTable.fnSettings().aaSorting;
    if( aaSorting[0][0] !=2 || aaSorting[0][1] == 'desc'){
    oTable.fnSort( [[2,'asc'], [3,'asc']]);
    }else{
    oTable.fnSort( [[2,'desc'], [3,'asc']]);
    }
    });
    } );

    However it seems there needs to be done some modifcations for WpDtatables.

    Would that code work?

    Thanks for the attention!

  • [deleted] replied

    Hi sllow88,

    Yes with little modifications of what you need. You will also have to change table selector #tablehtml to #table_1, #table_2... You can see what is the selector of the table when you inspect elements. And this code with little modifications would work on non-editable tables. For MySQL and Manual tables you can use MySQL query to sort table.