Unsorted default view

Unsorted default view

ChTreeChTree Posts: 2Questions: 0Answers: 0

I have a table in html page. To make it sortable and searchable I added:

$(document).ready(function() { $('#maintable').DataTable( { "paging": false, "info": false } ); } );

It works fine except the default view comes with rows sorted by the first column.
I generate the table in certain order which I want to see on the default view and restore by clicking on Refresh icon.
How can i get the default view (when the html page shows up the first time) unsorted?
I would really appreciate simple solution and plain English explanation as I have no experience in this area.
(I was thinking of creating a fake first column with numbers 1, 2, ... and may be making it hidden, but an pretty sure there is a better solution)

Thanks

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @ChTree ,

    Just add an empty order, it'll do the trick:

    $(document).ready(function() { $('#maintable').DataTable( { "paging": false, "info": false, order: [] } ); } );
    

    Cheers,

    Colin

  • ChTreeChTree Posts: 2Questions: 0Answers: 0

    Thanks, Colin

This discussion has been closed.