Use data ordering on init

Use data ordering on init

edikaedika Posts: 20Questions: 9Answers: 0

I'm trying to display the result of a search in a datatable and would like them to be displayed as they are provided in the data source, as they are already sorted by best match, based on the search parameters.
I tried removing the 'order' option but data is still sorted in ascending order in column[0].
Is there a way to prevent data from being sorted unless requested by the user?

Thanks

best regards

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,292Questions: 26Answers: 4,944

    Set the ordering option to false. The table should then be displayed in the order the rows are received from the source.

    Kevin

  • edikaedika Posts: 20Questions: 9Answers: 0

    Thanks kthorngern that's works, but remove the option to sort the table by columns. I want to leave this option to the user.
    Is there a way to do that?

  • allanallan Posts: 63,439Questions: 1Answers: 10,459 Site admin
    Answer ✓

    Set order to be an empty array if you want no default ordering, but still want the end user to be able to order the data when clicking on a column header.

    Allan

  • edikaedika Posts: 20Questions: 9Answers: 0

    Thanks allan, this is the perfect solution

Sign In or Register to comment.