-1

Im doing a MVC web project in .NET, and kind of thinking best way to show a list and pagination. I have 3 options

  1. I can show the table using Jquery Tables(Data Table JS).
  2. I can use MVC pagination.
  3. Manually handling pagination using a SP.

Option 1 will fetch all data at once using a AJAX, and table js will handle paging itself. We don't have to worry about paging,but if it's a huge data set to handle will it wise to have this ???, because every time it will load all the data.

Option 2 will get only the data which will need to show (Set by set), but each time a request may be triggered to the server side.(This will manage the pagination in controller level IPagedList)

Option 3 also will fetch only the data we need from the database level. Same as option 2 will const server request for each page changes.

So what would be the best option, we have to think about two scenarios may be. That will be if it is big data set and if it is small data set.

What are the best ways of doing this? Appreciate any explanation ?

Anushka Madushan
  • 577
  • 1
  • 4
  • 12
  • Possible duplicate of [Pagination: Server Side or Client Side?](https://stackoverflow.com/questions/407878/pagination-server-side-or-client-side) – Carsten Franke Sep 21 '18 at 06:06

3 Answers3

1

An obvious solution is to go with option 2. But in which a user can able configure records per page so that if records per page are less, then it will load instant in the browser as well as pull data from server quickly. A user is never ready to see loading they want the result as soon as possible.

Here you need to also take care of sorting in the grid if you are providing sorting feature. Means you need to sort in entire dataset instead of just in the current dataset.

Further, you can also provide a filter on the grid. Same concern, you need to filter the entire dataset.

So this approach will work with both scenarios like small dataset as well as the large dataset.

Keyur Ramoliya
  • 1,900
  • 2
  • 16
  • 17
0

According to you options,

  1. I can show the table using Jquery Tables(Data Table JS).

Datatable is a very good option which comes with more other functions such as filter, search, sort, info and many more.

Depending on your dataset size you should choose between client side implementation and server side implementation. If you have rows less that 4000 I'm suggesting you the client side use of datatables.

But if you have seriously large dataset make sure to use server side implementation for datatable. This link here gives the steps how you can implement server side module for datatable

SilentCoder
  • 1,970
  • 1
  • 16
  • 21
0

I'd say it is always preferable to load only the data you need. Why should you load data which are not visible at all?

Thinks to consider if you let the GUI framework handle the pagination on the client side:

  • You do not have to bother with it at all. Also filtering and sorting is most likely handled on the client side as well.
  • It is easier to implement for beginners.
  • If your application is going to run on the intranet only, it might be perfectly okay (from a performance point of view) to let the client handle larger data sets.

Thinks to consider if you take care of the pagination yourself:

  • You have to implement sorting and filter as well! You cannot have sorting and filtering on the client if you are paging on the server. This implementation can be quite troublesome.
  • It loads its data much faster because you do not receive any data which would not be shown anyways.

So what you should take highly depends on your data, your infrastructure and your audience.

Some more good points were mentioned on Pagination: Server Side or Client Side?

Carsten Franke
  • 1,649
  • 2
  • 13
  • 30
  • Yes as i feel it's depend on the data. But im in a doubt when it comes to scalabilty of the project. Currently this project will not have big data set. But if we are thinking in the future who knows may be if the client wants to expand it. will this be a matter in architectural wise. – Anushka Madushan Sep 21 '18 at 06:11
  • I had to learn it the hard way (unfortunately multiple times): The customer has more data then you anticipated. Always! So better do it right from the beginning... – Carsten Franke Sep 21 '18 at 06:14