JoomGalleryfriends / JG4-dev

Development repository for JoomGallery v4.x
GNU General Public License v3.0
10 stars 6 forks source link

[CategoryModel, frontend] Reopening category does not open the first images of the pagination #180

Open reilldesign opened 6 months ago

reilldesign commented 6 months ago

When implementing the infinite scroll function, I noticed an error with the pagination. When reopening a category, not the first x images are loaded but the state of the previous pagination value. For example, 15 images with a display of 5 images per page result in three page links in the pagination 1 | 2 | 3. If I now navigate to page 2 and reopen the gallery, it starts with page 2 instead of page 1.

Elfangor93 commented 6 months ago

I can confirm this. But its not a bug, its a feature ;-) Which of course can be changed...

Do you want to get rid of this remembering behavior in all list views in the frontend or only in the category view? Do we wanna keep the this remembering of the current page in the admin list views (images and categories)?

To change the behavior this line has to be added to the specific list model in the populateState() method after parent::populateState(). $this->setState('list.start', $app->getInput()->get('limitstart', 0, 'uint'));

reilldesign commented 6 months ago

As I haven't come across this feature before, I don't have a clear opinion. However, it is a hindrance for the infinite scroll display, as the pagination is not displayed and the visitor does not know where he is.

Elfangor93 commented 6 months ago

You have this feature in all core components in the backend.

Elfangor93 commented 6 months ago

I clearly see why it is not very practical in the category view. But what about the other list views? Do you want it there?

reilldesign commented 6 months ago

In the list views it is very practical for editing and sorting the images.

Elfangor93 commented 6 months ago

So then in a future PR the following line should be added to the frontend category model inside the populateState() method after parent::populateState() was called to reset the limitstart when reopening the category view. $this->setState('list.start', $app->getInput()->get('limitstart', 0, 'uint'));

reilldesign commented 5 months ago

@Elfangor93 please create the corresponding pull request for the category view. I am unsure about the implementation.