Generate the row at the top of the table.

Generate the row at the top of the table.

arindamarindam Posts: 1Questions: 1Answers: 0

How to use the addRow() method to generate a new row at the top of the table. By default the row appends with the table. I need to prepend it.

Thanks in advance

Answers

  • crush123crush123 Posts: 417Questions: 126Answers: 18

    doesn't it depend on the sort order of the table ?

    You could order by eg ID 'desc' by default so any new rows would appear at the top

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin

    What is the addRow() method?

    As @crush123 says ordering in DataTables is defined entirely by the ordering applied to the table. So if you want a row to appear at the top, make sure it comes first in the applied ordering!

    Allan

This discussion has been closed.