F
Filamentβ€’12mo ago
ArnoNym

HeaderActions in Component (not Resource)

Ciao helpful Filament Community I am trying to add a headeraction to a table. This works fine in a class that extends Resource (first and second screenshot). But in another project i have a different structure and i want to set a headeraction in a Class that extends Component (third screenshot). This headeraction inside a component class is shown in a strange way and i cant set a label or color. Also my npm run dev is showing a warning which could be a hint for the problem but i dont know:
"(node:13620) Warning: An error event has already been emitted on the socket. Please use the destroy method on the socket while handling a 'clientError' event. (Use node --trace-warnings ... to show where the warning was created)" Can someone tell me why i cant use headeractions inside a Class that extends Component instead of Resource? And maybe tell me how the correct way would be? Thanks alot in advance
No description
No description
No description
No description
8 Replies
ArnoNym
ArnoNymOPβ€’12mo ago
ArnoNym
ArnoNymOPβ€’12mo ago
Bump
awcodes
awcodesβ€’12mo ago
According to the docs that looks right though. Make sure you imported all the right classes.
ArnoNym
ArnoNymOPβ€’12mo ago
Thanks for the reply. @awcodes I am quite sure we installed all the classes but i will doubleCheck. Are you able to add an action to headeractions in a component without this strange visualisation?
awcodes
awcodesβ€’12mo ago
working fine for me
No description
awcodes
awcodesβ€’12mo ago
public function table(Table $table): Table
{
return $table
->query(Page::query())
->headerActions([
Action::make('test_action')
->label('Test Action'),
])
->actions([])
->columns([
TextColumn::make('title'),
]);
}
public function table(Table $table): Table
{
return $table
->query(Page::query())
->headerActions([
Action::make('test_action')
->label('Test Action'),
])
->actions([])
->columns([
TextColumn::make('title'),
]);
}
Looks like it's just not getting the color applied.
ArnoNym
ArnoNymOPβ€’12mo ago
😌 so it seems the problem is just in my setup and i have to deppDive into the classes to find the missing installation. Just to make sure: Your example is inside a (class extends) component and not inside a (class extends) resource isnt it?
awcodes
awcodesβ€’12mo ago
correct it was in a custom livewire component
Want results from more Discord servers?
Add your server