P
P
poimanoo2018-10-20 19:26:22
Yii
poimanoo, 2018-10-20 19:26:22

YII2 - How to display products in a grid and with filters?

Good day. I'm trying to implement a site on YII2, I'm asking for advice on how to do the following correctly: you need to display the products on the site in the form of a grid, and so that for this grid there is a set of filters and a choice of sorting option.
Key thoughts:
1 - ListView and GridView, as far as I understand, display differently, or can it somehow be configured for the grid option? If so, I would appreciate an example. PS - the aspect of manipulating the grid like in bootstrap is also important here, so that everything is ok in the mobile version - is it really possible to do this?
2 - How to implement sorting and, most importantly, filters - when applying a filter, update only the grid or the entire page? Of course, the option with updating only the grid looks more attractive, it's just that the site is planned as a flea market where everything and everything from other sites will be parsed, and I'm worried about the performance issue - updating only the grid using PJAX (or is it done somehow differently?) with a large number of products will it somehow affect the speed? or limiting the number of displayed products by pagination solves this problem? I just focus on, for example, bulletin boards - the same Yula reloads the entire page when applying the filter, surely there are good reasons for this or not?
I really hope to get an exhaustive answer or an exhaustive set of answers, thank you in advance to everyone and everyone)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
weblucker, 2018-10-21
@weblucker

Hello, I will answer the second one, and someone more savvy will answer the first one :)
Updating the grid with pagination should not cause significant troubles, especially if the product card on the preview is not overloaded - in fact, it will be, for example, issuing 30 products with a price, name and picture - quite feasible for JAX, except put a small image in the preview. If possible - you can stick caching.
But if there is a feeling that users will break from mobile and from bad Internet, then in order not to take risks, you can not use dynamic loading - this will make the site less responsive, but it does not greatly affect the user experience.
Yula, I think, chose this for the reason that it is easier to implement, it works everywhere, incl. and without scripts, and the damage is minimal. I doubt very much that at least one person left Yula because his page took longer to load.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question