Conditional actions on table columns

Hi all! I have a table, along the Y axis (rows) is a list of locations, and each column along the X axis is information from different relations to that Location (complianceA.name, complianceB.name). I want the ability when clicking on the column, to either open an edit modal for the relation if it exists, and to open a create modal for the relation if it does not exist. Any help appreciated!
11 Replies
toeknee
toeknee4w ago
Just conditionall show them ->visible(fn($record) => count($record->relationship) > 0) for edit ->visible(fn($record) => count($record->relationship) < 0) for create
Grogu
GroguOP4w ago
Thanks @toeknee , Am I doing this wrong? Whatever is the bottom action will never work:
toeknee
toeknee4w ago
On edit remove !! And ensure they are different names
Grogu
GroguOP4w ago
Mmmm cant get that to work, sorry @toeknee do you mind showing me the code you think would work? Really appreciate your help!
toeknee
toeknee4w ago
I’m just out so won’t be able to see till later, what’s happening
Grogu
GroguOP4w ago
No problem 🙂
toeknee
toeknee4w ago
Ahh you se it to ->using()
Grogu
GroguOP4w ago
I've got it to work with this code, but it feels weird 😂
Grogu
GroguOP4w ago
toeknee
toeknee4w ago
Replace that with ->action() Seems ok from my phone, but yeah usually you need action, not familiar with using
Grogu
GroguOP4w ago
Thanks @toeknee , I've sort of hacked it together. You've been v helpful!

Did you find this page helpful?