Adding row on top when sorting on columns are disabled

Adding row on top when sorting on columns are disabled

manoj_tailormanoj_tailor Posts: 2Questions: 0Answers: 0
edited December 2013 in DataTables 1.9
I have a json array by which I want to add new rows on top of existing datatable. The sorting is disabled while initializing datatable.
My code is:
[code]
$("#depTable").dataTable().fnAddData(data,true);
[/code]

Replies

  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin
    If you have sorting disabled, then there is no ordering at all on the rows int he table and you can't insert a row in a specific position (since there is no order!). If you want to put a row in a specific position you need to enable sorting and force the data in the table to comply to the order that you want to display it in - the aaSortingFixed option might be useful for example.

    Allan
  • manoj_tailormanoj_tailor Posts: 2Questions: 0Answers: 0
    Thanks for your reply. aaSortingFixed option helped me. I just used a invisible column and on this i did the sorting. and that fulfill my requirement of adding row on top the table.
This discussion has been closed.