How to sort bootstrap datatable,based on date

qasimidl 106 Reputation points
2022-06-30T07:37:17.32+00:00

Hi,

I m using bootstrap and datatable to bind with html table ,

Problem: i have column ,based on date
DD-MM-YYYY hh:mm, its now sorting properly,
I bind data on button click not on load page

Solution required. How can i sort it desc on load time , and when user click on it so it should come on asc orderr

Please guide .

Microsoft 365 and Office SharePoint Development
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2022-07-01T09:57:21.847+00:00

    Hi @qasimidl
    Per my test, you can use following code to sort table by date
    216819-test.txt


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.