orchidsoftware / orchidsoftware/platform

Button on screen with pagination enabled throws an exception: method not found

Open
#2,845 0 comments 0 reactions 1 assignee View on GitHub

@tabuna is already working on this.

Since Jun 19, 2024.

Errors
Dominant language
PHP
Stars
4.8k
Forks
662
Avg merge
1d 9h
Merged PRs (30d)
7

Description

Describe the bug
Hello. I have a screen with pagination enabled, so pages comes with URLs like /images/all?page=1

I place a button in a modal window on the screen. Like that:
Layout::modal (async)
.. Layout::table
.... TD::make
...... ->render
........ Button::make('text')->method('setImage', [
........ 'preview' => $preview->id,
........ 'image' => $this->image->id,
........ ]),

Buttons are created with:
formaction="http://.../images/all?page=1/setImage?preview=629&image=75"

That's because
Button.php:81
$action = rtrim("{$url}/{$this->get('method')}?{$query}", '/?');

and $url = http://.../images/all?page=1

So then I click on the button it throws an exception: method all() not found
If I open URL without ?page=1 everything works as expected.

How can it be fixed? Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.