Timster8989
afterStateUpdated in custom component
I have a Filament widget which includes a Livewire component from it's blade. I have a select-field rendering fine and it will update the value. However, I can't get it to run method no matter what I do. Here is the code I've been trying with:
The view has nothing else than this:
Any help here would be greatly appreciated (and yes, I've been reading documentation and other posts back and forth)!
3 replies
View column javascript
Any good pointers for using Javascript / Livewire inside a view column?
ie. this:
Vanilla JS to keep it simple:
This works on the first page, but when you navigate to second page in your listing, it will not have the function defined and it won't work. Any pointers from here?
4 replies
Custom table component + javascript library
I'm leveraging a custom view renderer in my table view:
and I'd like to use it to display Apex chart. I can of course include Apex chart for this view file, this way it works, but is hardly the way it should be done. If it was just another Livewire component that I could init myself, I could use x-init property. But as this is "Filament magic" that's happening here, I have not found a sensible way to include this script just once and make it work inside my custom view. If you want to test, here is a minimum example of a blade file to use:
As always, any help is greatly appreciated!
4 replies
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!
11 replies
Custom Javascript inside widget
Excuse me for my ignorance, but I'm trying to understand the right way to use custom javascript inside Filament widget. Maybe I'm missing something basic, but I just can't get it to work. Case example here is swiper.js.
I'm loading Swiper library & css in AppServiceProvider:
I've tried couple approaches:
1) Init the script inside widget
2) FilamentView::registerRenderHook('panels::body.end'
Now if I render my test code using the renderHook, it works. But inside Livewire component it will not.
Here is how to init the library:
Here is a test HTML:
4 replies
Related record, pivot extra column values
I'm trying to understand what happens in save over with this:
Forms\Components\BelongsToManyMultiSelect::make('role') ->multiple() ->relationship('role','title',fn($query) => $query->where('title','!=','Super Admin')) ->options(Roles::all()->pluck('title', 'id')->toArray()), It seems none of the model defaults are run, but the insert is raw SQL, so it's rather hard to hook into it to put some default values in place. Any pointers? ps. was trying to understand this through form components/Select.php, which has this nice 400 line Christmas tree method called "relationship" without really too relevant comments. Uh. Any clue as to why the whole Filament source code is largely undocumented?
Forms\Components\BelongsToManyMultiSelect::make('role') ->multiple() ->relationship('role','title',fn($query) => $query->where('title','!=','Super Admin')) ->options(Roles::all()->pluck('title', 'id')->toArray()), It seems none of the model defaults are run, but the insert is raw SQL, so it's rather hard to hook into it to put some default values in place. Any pointers? ps. was trying to understand this through form components/Select.php, which has this nice 400 line Christmas tree method called "relationship" without really too relevant comments. Uh. Any clue as to why the whole Filament source code is largely undocumented?
3 replies
Understanding view rendering
I'm trying to get the css hooks to work, but I think I'm misunderstanding something. I have this problem both in my own app & in the demo app.
If I add this:
.fi-form {
@apply !bg-blue-300 !p-12 rounded-xl;
}
to resources/css/app.css and run "npm run build", I get nothing. How is the publishing supposed to work?
Thanks for the help in advance!
ps. I'm not new to PHP and neither to Laravel or Livewire, but I'm really struggling to understand some aspects of Filament. There is a lot of power, but as there are no source code comments there is a lot of trial and error. If I continue with Filament, I'm sure to submit some PR's regarding the documentation and code comments...
41 replies