We want to Know logic of table row sorting in data table

We want to Know logic of table row sorting in data table

devidas@123devidas@123 Posts: 2Questions: 0Answers: 0

We want to Know logic of table row sorting in data table

In our project data show correct but i want to highlight the latest record but i dont get i value in while loop . Its shows randomly value of i if we printed

Please give me proper guidance

Replies

  • kthorngrenkthorngren Posts: 4,582Questions: 19Answers: 1,007
    edited December 2018

    There isn't much detail of how you are designating the latest record. You might want to use row().node() using a row-selector that will choose the row you want. If this doesn't help please provide a test case replicating your issue so we can help.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • devidas@123devidas@123 Posts: 2Questions: 0Answers: 0

    Hi kthorngren,
    Thanks for replied on my queries. My details description is as.

    I want to highlight, first 10 records or first 5 records. How I can find row id which is display in ascending order. If i applied logic manually for while loop with variable i and increment it by 1 then its not showing me the value of i variable in order like 1,2,3,4.etc/ Its randomly shows.

    My problem is , I cant able to find first 5 or 10 records in datatables which currently shows in ascending/descending order. I want add custom css class to highlight it.

    would this information helpful you to understand better for my queries. I am using DataTables-1.10.12 version.

    Looking forward to hear you.

    Thanks
    Devidas

  • colincolin Posts: 3,347Questions: 0Answers: 595
    edited December 2018

    Hi @devidas@123 ,

    You can get the current order by using the API like this api.rows({order:'applied', page: 'current'}).

    Alternatively, if you just want to colour the top few rows, you could do it on each draw, like this,

    Cheers,

    Colin

Sign In or Register to comment.