Jump to content

Rendering a lister in a Process module execute subpage method other than execute() [SOLVED]


Recommended Posts

Posted

As per my own use and the linked forum topic, it's possible to render a lister in an execute() method of a Process module without any problem.

However, once I try to render it in a sub page of the Process module, eg executePage1() it doesn't render correctly, with only the header of the lister rendering, and then the content of the execute()  (not executePage1()) method rendering underneath it.

I think there might be some conflict between url segments used by Process modules to identify subpages and lister. It seems like calling the execute() method of the lister is partially working, but then calling the execute() method of the module it's called from after it's rendered its header.

I'm using the latest build of ProcessWire.

Is it possible to have a lister render in a subpage of a Process module? If not, are there any alternatives  to display a lister predefined in module code?

Posted

It's working for me.

public function ___executeFoo() {
	$lister = $this->wire()->modules->get('ProcessPageLister');
	return $lister->execute();
}

image.png.1ee072f0f691c61910ae0f8138da5bd5.png

Maybe check your browser console for JS errors, or start with a minimal example like the one above.

Posted

That's weird. I simplified it down to the bare minimum as per the example, and still not working.

I wonder if it's some strange third party module interaction?

I don't a lot of modules beyond the core loaded, just these: image.png.9880ad0a14f06cbb12c867bc63a1109a.png

I've tried disabling all autoload modules (other than core) via Tracy debugger, and the problem persists.

Posted

What I can see using Chrome Devtools, is immediately after the subpage is loaded, there's a jquery call to the execute method.

What I think is happening is ProcessPageLister is trying to call it's own execute method to load the list, but instead is loading the execute method of the page it's on, resulting in loading the content from the execute() parent page underneath the lister headers.

I've set the code to the same as the example that apparently works but it's still resulting in the same issue.

Posted

Not tested, but you can also try some of its setters:
 

$root = $pages->get('template=subpage_parent');
$lister = $this->wire()->modules->get('ProcessPageLister');
$lister->set('rootPageID', (int) $root->id);
$lister->set('parent', $root);
$lister->execute();

 

Posted
7 hours ago, Robin S said:

@Kiwi Chris, check that you are loading your URL segment with a trailing slash. If you're using the "nav" item in the module info your URLs should have the trailing slash like shown the ProcessHello demo module: https://github.com/ryancramerdesign/ProcessHello/blob/189029f494870760107d8a621dfb5a59db53959c/ProcessHello.info.php#L55-L77

Thanks. This was the problem.

  • Kiwi Chris changed the title to Rendering a lister in a Process module execute subpage method other than execute() [SOLVED]

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
×
×
  • Create New...