How to set prependActions on table
Is there a similar method to the ->prependActions() method when creating a table definition in a TableWidget?
I'm getting the Table Actions like this:
but I don't think there's a getTablePrependActions() method similar to ->prependActions() , so I tried making a public function, but that didn't work.
Where am I going wrong here?
17 Replies
I think it was deprecated on the table. Why do you need
prependAction()
? Just add all actions you want into getTableActions()
it seems to get the Impersonate action/icon to show, I need to set both the table actions and table prepend actions.
I tried creating the table definition the other way, but it wasn't compatible with TableWidget
it works fine in my user resource, but I'm trying to create a widget showing similar results that also includes the impersonate action.
What is not working with just using
getTableActions()
?the impersonate icon is not showing up, which I'm assuming is because I'm not setting it in prepend actions
I have this working on the user resource page, but it doesn't show up on the user widget I created.
the main difference is I'm creating the table definition in the user resource using the method where I can set the prependAction. It appears you can't create tables the same way in tablewidgets, so I can't set that value.
There is not
prependActions()
and this feature just merged to actions into the same array, so there should be no difference. Let me just try this with an installation I haveWorks perfectly fine.
No sure whether that affects actions, but do you have any permissions/policies that might hide this?
Can you show the full table widget code?
Can you try removing
$view
and $render
?I removed $view and the render method and it had no impact
still shows a table of users, just no impersonate icon
Weird. I am out of ideas. Sorry.
can you share your user widget code that works?
Can the shown users even be impersonated?
hot digity, that worked. Not sure what I had in my code that was breaking it, but I'll find out as I add things back, if needed. Thanks!
can that action be set on the user's name instead of having an icon? I know the icon makes the action clearer, but the main/only reason for this widget is impersonation.
You could try
TextColumn::make('name')->action(Impersonate::make())
Not sure whether that works out of the box thoughI was just about to post that exact thing. It did work out of the box:
Nice 👌🏼