Table Columns from Database
Been trying to figure this for weeks, and gotten to the point I just need help!
I'm wanting a custom table, which gets the rows from a database table as normal, and the columns from another database table (rather than the standard database column names) to create a matrix of sorts.
Excusing the below mess showing where I'm up to (just trying to get it working at this stage), the action doesn't seem to be running when I click on a cell.
19 Replies
Any help would be hugely appreciated
Why are they not just releationships?
What does your
dd('Row ID: '.$record->id, 'Column ID: '.$academy->id);
output?
I guess you might just need a ->record($academy)
on either your column or action (or both)Nothing happens on the action, i dont get the output of dd()
It’s like a blank click
I imagine they will be when I get further down the line, but at the moment I'm not even that far. I just need the table working so I can grab the column ID as well as the row ID when a particular cell is clicked
Wonder if it’s because you’re not returning the Action::make(‘select’)
No, sorry, noticed that as soon as I posted, put a return on there and still nothing. It’s like there’s no action on click, even a blank dd() doesn’t output anything
Do you have spatie’s ray? Sometimes dd doesn’t work in callbacks in livewire.
Ah no, I’m just a bedroom coder so haven’t stumped up for that
But instead of a dd(), if I try some real action it may work
Maybe try a Log instead
Will do, will update thread tomorrow
Nothing hitting the log either
It's almost like the action isn't running
Wasn't 100% (or 10%) confident the code structure is right, does it look like it should work?
Another thing that comes to my mind: You create multiple actions with the same name ("select"). That will also lead to errors. Probably not the current error though
Thanks, I've changed to:
Still no luck with the action running though
Any further ideas anyone?
When are you calling the build function? Post page load?
It's called in the DocumentMatrixResource, I just always split it out to try and keep the resource clean:
I assume this is a custom livewire component? Are you mounting it?
Hi @toeknee - apologies, been on holiday so only just seen this. I'm not sure what you mean by custom livewire component and mounting it. I've created a new resource, and I am trying to adapt the table within the resource to fit my needs.
So I've got the action working, whereby the form loads and then I can select a drop down and click submit and the action logs. However, it always tries to add it for the last academy (ID: 8). Any ideas why? I'm rocked backwards and forwards for a while on this with no joy. Actually thought I figured it yesterday, could have sworn it was working as intended, but then it stopped. I went through and undid all my changes to try and get it back to the point but never got it working again so it was either a fluke or I dreamt it.
If I change the action to above so that it is a function, running a dd($academy) returns the right academy whatever is clicked on - but the Action doesn't work in this format
So, I can have the action work through
But that always uses the last academy. Or I can have it work with the right academy using
But the Action doesn't work then (i.e. the form etc won't load on click)
Seems this is the 'issue' I'm coming across:
GitHub
The column action doesn't work if a closure is used as parameter · ...
Package filament/filament Package Version v2.17.40 Laravel Version v10.11.0 Livewire Version v2.12.3 PHP Version PHP 8.2.4 Problem description The modal is not displayed if a closure is used as a p...
Would appreciate any advice on how best to work this