Adding data without sort

Adding data without sort

barrykeepencebarrykeepence Posts: 22Questions: 0Answers: 0
edited May 2013 in General
I am adding data to a table dynamically using fnAddData. My query back end has already ordered it as I want it initially and that is how I would like to show it initially. The user can sort it later as they wish.

Can we have an option please on fnAddData to add the data with no sorting of the array. I think this will also give a speedup for me as I have some very large tables and my server has already done the work to get them in the order I want.

I have looked through the forums and I can't see a way of doing this. Am I missing something? Setting bSort:false will not work as I want the user to be able to sort the columns.

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    If there is sorting applied to the table, the data you add with be added in the correct place according to that sorting. If there is no sorting applied, it will be added at the end of the table.

    Allan
  • barrykeepencebarrykeepence Posts: 22Questions: 0Answers: 0
    Hi,

    that does not seem to be happening. My first column is set to bSortable: false and it still sorts on this first column.
    I have a fresh datatable and this is the first time I add data to it. I have tested the data just before the call and it is ok.

    Barry
  • barrykeepencebarrykeepence Posts: 22Questions: 0Answers: 0
    aaSorting: [] on creation did the trick.

    Why not make this the default?
  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    Because a sorted table is required far more often that an unsorted one :-). Equally, I can't say if the data in the table is sorted in the correct way or not. Much better to leave it as it is.

    Allan
This discussion has been closed.