How to add a row at a specific Index

How to add a row at a specific Index

bradtmbradtm Posts: 1Questions: 0Answers: 0
edited September 2009 in General
I want to add a row at index 0 of the table, but I don't see anywhere that can accomplish this. Is there a way in conjunction with another function to do this?

Thanks,
brad

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi brad,

    The ordering in DataTables is entirely based upon sorting, and no other method. So array position etc doesn't matter at all. Hence the way to accomplish what you are looking for is to make sure that it comes at the top of the pile when sorting the table. One way to do this is to use a hidden sorting column (along with aaSortingFixed - http://datatables.net/usage/options#aaSortingFixed to make sure this column is always sorted upon) and putting i the require order number in there.

    Regards,
    Allan
This discussion has been closed.