Dynamicly add new values on top

Dynamicly add new values on top

wwwwwwwwww Posts: 1Questions: 0Answers: 0
edited July 2011 in General
So yeah, im getting very frustrated, all new values I add to the table dynamicly
[code]$('#table').dataTable().fnAddData(['value']) [/code]
either gets in a random order OR at the bottom.. I want all new values to go on the top of the table.

My table:

[code]$('#table').dataTable({"sPaginationType": "full_numbers","aaSorting": [[ 0, "desc" ]],"bFilter": false, "bInfo": true});[/code]

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Here is an example of adding new rows which shows that it shouldn't be random: http://datatables.net/release-datatables/examples/api/add_row.html . Indeed, after each add of a new row to the table, DataTables will do a full resort - so the new data you enter into the table will be in the correct position for the sorting that is applied to the table. If you want the new row at the top, you need to ensure that it is at the top with the sorting applied to the table.

    Allan
This discussion has been closed.