Gridview client-side sorting, filtering and pagination

Does gridview support handling data client-side instead of having to query the server every time the user requests one of these actions? If so, where can I find a guide? I’ve been looking but unfortunately can’t find anything.

Hi @chazy

No, we can’t do that, because handling data all in the client side is not a feasible idea in the real world.

Think of a use case where you have 100,000,000 records in db. If you would want to sort, filter and paginate them all in the client side, you would have to send all of the 100,000,000 records in the initial page loading. That would not be a good idea.

Hi @softark

Aren’t you being a bit extremist? I can see there may be cases where it would not make sense but that doesn’t mean there aren’t cases where it would.

Also, there are efficient ways of loading data into the client other than in the initial request. And I don’t see any client having trouble handling 100.000.000 records, it’s 2020 already ))

Mobile processors have been more than powerful enough to handle large chunks of data for a while now, and cheap portable devices also come with more than enough system memory so I don’t see where the problem is.

Although, I was thinking more for use cases where there are less than 1 million records. By offloading trivial tasks, the server has less load and can serve more requests and the user only has to wait once, then no more waiting times, plus power saving and even data usage saving in some cases… way better than having to request the server each time.

Anyways, it seems I’ll have to use some other solution, and DataTables seems like the perfect choice.

Just my opinion on the matter, if you think I’m mistaken please correct me, I’d like to know if I’m being way too optimistic.

Hi @chazy,

OK, I think I got your point. You may be right.

Yii framework 2.0 is basically a server-side solution which doesn’t assume a kind of data pool on the client side. So the gridview of it always does sorting, filtering and pagination of data on the server side.

jQuery Datatables?

1 Like

@JohnBrooking Yes, I implemented it the other day, works perfectly. I just wanted to know if Yii2’s GridView offered a similar functionality.