Widget order on a panel

Any pointers on how to change the order of widgets in a panel? I've tried changing the order in the panel provider, changing the sort attribute inside widget, but it doesn't seem to work. Any help here is appreciated!
9 Replies
toeknee
toeknee14mo ago
try in the widgets to do: protected static ?int $sort = 0; protected static ?int $sort = 1; etc
DrByte
DrByte14mo ago
Timster8989
Timster8989OP14mo ago
First one has sort set to 1, Hello World widget's sorting is 3 and the third widget here has sorting 2. And in the panel they are included in the same order.
->widgets([
LevelProgress::class,
SearchWidget::class,
HelloWorldWidget::class,
])
->widgets([
LevelProgress::class,
SearchWidget::class,
HelloWorldWidget::class,
])
Another odd thing here is the double spacing in the grid here. And no, I don't use autodiscovery / load from path.
No description
DrByte
DrByte13mo ago
GitHub
demo/app/Filament/Widgets at main · filamentphp/demo
Source code for the demo.filamentphp.com website. Contribute to filamentphp/demo development by creating an account on GitHub.
DrByte
DrByte13mo ago
The default sort shows up this way:
No description
DrByte
DrByte13mo ago
But then simply editing the $sort on the first 3 widgets:
No description
No description
No description
DrByte
DrByte13mo ago
results in the new order in the dashboard:
No description
Timster8989
Timster8989OP13mo ago
Thank you so much for your help! This was entirely my own stupidity; I had to include the "dashboard" using render hook as passing main page javascript to widgets turned out to be little problematic. Trying to get around this by using "panels::page.footer-widgets.before" render hook. Unfortunately:
public function getFooterWidgets(): array
{
return [
\App\Filament\Widgets\FooterWidget::class,
];
}`
public function getFooterWidgets(): array
{
return [
\App\Filament\Widgets\FooterWidget::class,
];
}`
Inside the Dashboard.php page results in "Unable to find component: [app.filament.widgets.footer-widget]". This happens even if I have nothing defined inside the widget. Maybe I'm again misunderstanding something?
DrByte
DrByte13mo ago
Did you create both the widget component PHP class and the corresponding blade file for it?
Want results from more Discord servers?
Add your server