laravel-splade icon indicating copy to clipboard operation
laravel-splade copied to clipboard

Problems with several x-splade-tables on same page

Open mbeckerle-xqueue opened this issue 2 years ago • 6 comments

  • Laravel Version: 10.14.1
  • PHP Version: 8.1.2
  • Splade JS Version (npm): 1.4.11
  • Splade PHP Version (composer): 1.4.15.1
  • Dev environment (OS, Sail/Valet/etc): ...

Description:

In my project I have several tables on a single page. When I search or filter, it does not take care of which table I filter for. It just appends some generric parameter to the URL causing ALL tables to execute the command, e.g. edit?sort=name. If some table does not support sorting by name, it will fail. If all tables support it... all tables will be sorted.

I tried using ->name(...) on the tables but aparently with no effect.

Before Splade, I used protonemedias vue tables: https://github.com/protonemedia/inertiajs-tables-laravel-query-builder

Here I had a section about "Multiple tables per page" where it explained, that I have to set some keys, e.g. InertiaTable::updateQueryBuilderParameters('companies'); for the query builder (some kind of prefix), set the page name: ->paginate(pageName: 'companiesPage') and finally set a name for the table (in controller as well as the vue file): name="companies"

Then, if you searched or sorted, it prepended that name/key so you were able to have n tables on the same page and sorting organization table by name would generate some url parameter with ?organizations.name=whatever etc.

I assumed it is possible but this is also where I finally gave up. Either it is missing or documentation needs to be updated. Thank you for looking into this.

Steps To Reproduce Issue:

Add two tables on same page and try to sort/filter one without sorting the other...

mbeckerle-xqueue avatar Jul 07 '23 06:07 mbeckerle-xqueue

I still have not found a solution and it is a blocker. Has no one experienced this problem in some other project?

mbeckerle-xqueue avatar Aug 06 '23 17:08 mbeckerle-xqueue

I had this problem, it doesn't work at all

mbeckerle-xqueue

joaovdiasb avatar Aug 06 '23 21:08 joaovdiasb

I can confirm this.

EmilMoe avatar Aug 24 '23 21:08 EmilMoe

The same problem

barnoma-soz avatar Sep 24 '23 20:09 barnoma-soz

@pascalbaljet any updates on this issue, because this is a show stopper

sirikkoster avatar Oct 26 '23 06:10 sirikkoster

I have the same problem

benguyucel avatar Nov 11 '23 22:11 benguyucel