DataTable only displaying 350 results of table, instead of the total 800+ rows.

DataTable only displaying 350 results of table, instead of the total 800+ rows.

kbessemerkbessemer Posts: 17Questions: 4Answers: 1

My DataTable says this on the bottom:
Showing 1 to 25 of 350 entries (filtered from 862 total entries)

Can someone explain how DataTables works in this respect? If I sort a column is it only sorting those 350 entries? If I search for something is it only searching those 350 entries?

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 3,000Questions: 87Answers: 421

    That depends on whether or not you have server side processing activated. I would recommend you post your dt initialization code and potential additional filters. Why do you only show 350 entries instead of the the total 862 entries in the first place?

  • kbessemerkbessemer Posts: 17Questions: 4Answers: 1

    Really not sure what happened but it isn't doing it anymore. The sorting isn't working properly though, my data is numerical and it is sorting 4 & 40 right next to eachother (for example)

  • rf1234rf1234 Posts: 3,000Questions: 87Answers: 421
    edited July 2022

    Your data isn't recognized as numeric. If your data isn't numeric according to Javascript your data are sorted like strings. So if you have a thousand separator in your numbers. Or even worse, a decimal comma instead of a decimal point this won't work. Just check out the sorting plugins for these things.

    Here is a link from SO on that topic: https://stackoverflow.com/questions/53238318/html5-javascript-datatables-order-sort-of-columns

  • kbessemerkbessemer Posts: 17Questions: 4Answers: 1

    Thank you, I found some strings in my data response and filtered that out, sorting is now working properly.

  • kbessemerkbessemer Posts: 17Questions: 4Answers: 1
    edited July 2022

    I am now trying to change the width of the table, the size seems fixed. I am using ReactJS with jQuery for this particular component. I have tried applying width: 100% to the class of the table, and also the dataTable class (I believe this is bootstrap). I have also tried inline CSS which is done differently in React.

    My table code...

  • kbessemerkbessemer Posts: 17Questions: 4Answers: 1
    Answer ✓

    Solution:

    div.dataTables_wrapper {
    padding-left: 10px;
    padding-right: 10px;
    width: 100%;
    margin: 0 auto;
    }

Sign In or Register to comment.