I think Livewire is a perfect fit for replacing Vue/React tables that offer search/sort/pagination/etc. Almost all of my apps have the need for tables like this and before now, Vue/React was perpetually a necessity for that reason.
Lately I have been working on Livewire Tables, which is my initial attempt at building a Livewire package for “datatables”.
Quick preview someone made with Bulma:
The vision for this is a table mostly configured by options available in the Livewire component, with minimal setup needed on the view side of things. It is style-agnostic, with CSS classes passed in via config (global) or in the PHP component (per-table). The PHP component is created with a
livewire-tables:make command, and once configured, the user runs a
livewire-tables:scaffold command which parses the component and builds out a view file containing the table.
May sound complex, actually super easy-to-use in practice.
I would consider what I released so far as Proof-of-Concept. At this point, I think there are a couple different directions we could take in the vein of expanding functionality (some of which are represented in open Github issues).
I know that there are far more proficient Livewire experts out there than me, and I want to make this a package that both shows off how effortless and easy Livewire can be, as well as providing everything a user could need in a table.
I’m open to any discussion on the package or idea, but I want to bring up one core focus that has been bugging me and honestly stopping me from making progress as I think about it: right now the user is encouraged to run the scaffold command to re-build the table view as options are changed in the PHP component.
The obvious pitfall of this is wiping away any customization the user has entered into the view file.
In my mind, it just doesn’t seem possible to offer all the configuration options a user might need to build their intended view. Some people will want a dropdown filter on the top right of the table. Some will want the search bar there. Surely custom buttons will be needed. With that in mind, it seems to make sense building the initial view file and then allowing the user to customize/expand as needed. This then becomes a problem when options are changed in the config/PHP class and the view needs to be scaffolded again.
I hope that all makes sense. I’m stuck between two paradigms, and neither seem to offer a full solution. I’d be really happy to hear any thoughts!