Loading only fixed number of entries on page load

Loading only fixed number of entries on page load

adityag28adityag28 Posts: 28Questions: 6Answers: 0

Hii, if I have around 1000 entries and I decide to show 100 entries per page.
When I will open the webpage, will it load all the 1000 entries in the starting or will load only 100 entries and then when I will go onto the next page, then it will load the other?

Answers

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951
    edited March 2022

    If you are using client side processing then the full table data resides in the client. If you use server side processing then only the page being displayed resides at the client. See the Processing modes docs for more details. Client side processing is more flexible and easier. 1000 should work fine with client side processing.

    Kevin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    It depends where the data is. If it's in the DOM, then by default it will load everything. If you're making an ajax call to get the data, again, by default it gets everything, but you can use serverSide to limit that. This section of the FAQ should help, it discusses various techniques to improve performance,

    Cheers,

    Colin

  • adityag28adityag28 Posts: 28Questions: 6Answers: 0

    Will having no more than 4000 entries not effect on the speed of the webpage?
    Means- If I load the full table which has a max of 400 entries, will speed of the webpage be affected?

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951

    The numbers posted in the FAQ are general guidance. The performance is affected by how long it takes to fetch the 4000 rows, the number of columns, how much custom rendering is taking place, etc. It is something you will need to test with your specific solution.

    Kevin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    If you've only got 400 records, just keep it simple and work in the client - that's minimal and DataTables wouldn't even break a sweat.

    Colin

  • adityag28adityag28 Posts: 28Questions: 6Answers: 0

    I have got around 3000 records, how do I first load only the records on the first page, to decrease the loading time?

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951

    Server side processing is the Datatable supported way of paging the server data. It requires a server script (Datatables provides some examples) that supports the SSP protocol.

    Or you can create your own paging mechanism and use ajax.data as a function to send information about what page of data to load. This willl be client side processing so you will likely want to use paging to disable paging. Sorting searching will also take place with the client side data.

    Kevin

  • adityag28adityag28 Posts: 28Questions: 6Answers: 0

    What should be my data-source in this?

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951

    What should be my data-source in this?

    The URL to your server script.

    Kevin

  • adityag28adityag28 Posts: 28Questions: 6Answers: 0

    I mean I am using Django as my backend and I am uploading the data from the admin panel. I am not using json file for this.

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951

    Not sure what the Admin Panel is. Datatables supports DOM sourced tables or tables loaded through Javascript or Ajax. See the Data docs for more details. To use Server Sid eProcessing you need to use the ajax option. There are third party Django libraries to support server side processing, like this:
    https://pypi.org/project/django-serverside-datatable/

    I haven't used any of them so not sure how well they work

    Kevin

  • adityag28adityag28 Posts: 28Questions: 6Answers: 0

    Thanks, I will try that.

Sign In or Register to comment.