Jump to content

pagination inside a process module


fruid
 Share

Recommended Posts

I'm having difficulties paging/paginating an array of pages inside a process module. (template "admin")

In the frontend, this seems to be more straightforward, but in admin, it seems to not know the segments. It shows the pager, it limits the results, however when I click on the next or any page it says "ProcessWire: Unrecognized path" and "Der Prozess hat keinen Inhalt ausgegeben." or something. The URL adds the segment /Seite2/

I thought I'd just have to allow pagination and segments in the settings of the listed pages's template, like I'm used to, but no, there must be more to it.

Has anyone been there?

Also, in other modules (not mine) I can see the pagination not working either. If I click on another page inside the pager, it reloads the same page. 

Link to comment
Share on other sites

3 hours ago, bernhard said:

I thought pagination was not meant to work on the backend

Why would you think so? Pagination has been available in the backend ever since I can remember. Lister (page finder) uses pagination 😀. I also know this since I have been using pagination in my modules. 

Link to comment
Share on other sites

59 minutes ago, kongondo said:

Do you have examples of modules whose pagination do not work?

in one PW project of mine, none of them work. I mean name any module that shows a pagination in the admin backend and the pagination doesn't work, core or site module.

My guess is it has to do with some sort of redirect somewhere though I cannot make out where and why.

Lister Pro module for example at least shows an error: {"error":false,"message":"Unknown Lister action"}

Link to comment
Share on other sites

22 minutes ago, zoeck said:

Im not sure, but you can activate the pagination inside of the „admin“ (System) Template.

I thought about that too, but I doubt that solves the bug or what it is. Also, it's not like the admin template is listed among all other templates for me to edit.

Link to comment
Share on other sites

59 minutes ago, zoeck said:

Im not sure, but you can activate the pagination inside of the „admin“ (System) Template.

Admin template already allows page numbers. Whatever is happening is a bug (but I am yet to try and replicate to rule out 'implementation').

35 minutes ago, fruid said:

I thought about that too, but I doubt that solves the bug or what it is. Also, it's not like the admin template is listed among all other templates for me to edit.

Setup > Templates > Filters: Show system templates.

Edited by kongondo
  • Like 1
Link to comment
Share on other sites

3 hours ago, fruid said:

My guess is it has to do with some sort of redirect somewhere though I cannot make out where and why.

 

…with that in mind, does that look weird to you?

image.thumb.png.c8c947682932085606973f1b88368f27.png

also, whenever I echo anything outside the <content></content> tag, it's echoed twice. I'm using markup regions BTW.

It might not seem related, but I think it's worth mentioning in this context.

Link to comment
Share on other sites

I'm positive it has nothing to do with Lister Pro per se because like I said, the pagination doesn't work for any module that uses pagination in this installation.
Also pretty sure it has nothing to do with the PHP version, it's the same PHP version for all other projects with no issues elsewhere. (MAMP sets one version for all projects)
PW version is 200 which is the master version.
MySQL version is also 5.7 for this and all other projects, so I guess I can rule this out too.

Other things I've tried:
exclude ready.php (maybe some hooks are messing up the admin) – no changes
exclude init.php (probably pointless cause that's just for frontend?) – no changes

I'm out of ideas

Link to comment
Share on other sites

I have also tested with 3.0.200 and it works fine.

pagination-demo-processwire-3.0_200.thumb.png.3f1d9ca7be52d6720574e5a621cb4b14.png

1 hour ago, fruid said:

I'm out of ideas

I'd suggest starting on a clean install in a similar environment but without any custom modules. Test that. If it works, add your custom modules one by one as you test each time you add a module. This is bound to reveal the cause. 

Link to comment
Share on other sites

I feel like I tried everything at this point. Install a fresh PW (200) with new database and one by one install the same modules as in the broken installation and test if at some point the pagination stops working. But it always works.

And I tried the other way around. I duplicated the broken installation's database and pointed the new installation to that database. As expected, the pagination doesn't work then. Then I UNinstalled all the modules one by one. But pagination never works. Uninstalling the modules, deleting the modules, clearing cache, compiled files. Deleting unused fields, unused templates, deleting all modules that require an update according to the diagnostics module. Uninstalling and deleting the diagnostics module, uninstalling and deleting Tracy Debugger. Nothing helps.

Tried in different browsers too. Cleared cookies, cache, all the good stuff.

The only issue I ran into when uninstalling all fields and template that used some special module was this:

Dangit… Fatal Error: Uncaught Error: Call to a member function set() on null in site/modules/FieldtypeColorPicker/FieldtypeColorPicker.module:46

I must have uninstalled some field or module that is required to edit the field in question. Don't know what though and I think I can assume that that's not the issue. Now I cannot edit the field, thus cannot delete it.

Anyway, I'm again, out of ideas.

Is my database corrupted? Diagnostics says it's fine. Are there too many entries for PW to handle?

BTW, what does that mean? (ProcessDiagnostics)

image.thumb.png.cf379b6cc96748891755ef305ef1b01e.png

P.S. This is what I dislike about this work/job/career. I can handle and enjoy logical errors because that just requires thinking and reasoning. But Debugging is basically searching for a needle in a haystack, it takes hours, days or weeks until you solve the problem and when it's done, the work that went into it is pretty much invisible to the client so it's hard or impossible to put a price on it, after all, I chose the tool that I would work with.

Link to comment
Share on other sites

When you tested in the fresh PW install, did you also copy all the code in site/templates, site/ready.php, site/init.php from the affected install to the fresh install? Or in other words, can you rule out with certainty that template or hook code might be responsible, especially hooks?

I once stumbled over a similar or at least related problem, where all PW queries in the page tree, that are done via ajax returned an error and pages tree stopped working. Then I discovered that an addHookBefore('ProcessHome::execute', $this, 'rootPage') was responsible. In my hook function 'rootPage', I had to do an if($this->config->ajax) return;

This is just what came to my mind when reading about your problem. 

11 hours ago, fruid said:

BTW, what does that mean? (ProcessDiagnostics)

image.thumb.png.cf379b6cc96748891755ef305ef1b01e.png

Did you follow the "Optimize" link and which table is this warning referring to?

11 hours ago, fruid said:

Are there too many entries for PW to handle?

How many entries are there in the DB table "pages"?

I can totally understand your frustration and think we all have been there at some point. But, at least for me, all those situations were resolvable in the end. Even if we cannot charge our clients for the effort we put in resolving those issues, these situations can help us to learn and get better at what we are doing.

  • Like 2
Link to comment
Share on other sites

I can rule out the effects of ready.php and init.php, I didn't try yet with all other template files but will do so today, I think that's the next logical step.

But then also, in the second attempt I described, where I just use the same database and none of the files from the file system, it doesn't work either. So if you think about it, the files couldn't be the problem either. That's why I have to assume that the issue lies in the database, but I wouldn't know how to go about finding the problem let alone repairing the database. Like I said, the diagnostic tool says it's fine. 

5 hours ago, gebeer said:

Did you follow the "Optimize" link and which table is this warning referring to?

16 hours ago, fruid said:

I clicked on it, but not much seems to happen other than that the warning disappears. But it returns eventually. Can't say for sure what table it is in the db (cause right now the warnings are gone) but often times it's a some cache.

6 hours ago, gebeer said:
17 hours ago, fruid said:

Are there too many entries for PW to handle?

 Some pages of a certain template amount to 4 digits,  if I filter anything that has an ID it amounts to 8000 something, so that can't be it either.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...