Power-Components / livewire-powergrid

⚡ PowerGrid generates modern, powerful and easy-to-customize data tables using Laravel Livewire.
https://livewire-powergrid.com
MIT License
1.48k stars 217 forks source link

Custom theme: styles not applying #1485

Closed luanfreitasdev closed 6 months ago

luanfreitasdev commented 6 months ago

Discussed in https://github.com/Power-Components/livewire-powergrid/discussions/1477

Originally posted by **keH1** March 26, 2024 Hello everyone, I've encountered a problem and can't figure out what's wrong. I'm trying to customize a table as instructed in the customization guide, and created my own class `'theme' => \App\Themes\TableGridTheme::class,` and registered it in the config. Like in instruction: https://livewire-powergrid.com/table/custom-theme.html I inherited from the Tailwind theme, refreshed the page - nothing works. Added to the search box a class "eewfewfwef", deleted all the others - refreshed the page - nothing. I reverted to the classic theme `'theme' => \PowerComponents\LivewirePowerGrid\Themes\Tailwind::class,` went to the path `vendor/power-components/livewire-powergrid/src/Themes/Tailwind.php` There, I added this class instead of others `eewfewfwef` and everything worked! What's the problem? Why can't it override the classes that I set in my own theme? Moreover, if I change the theme name, everything crashes with an exception that the theme cannot be found... Here is what I'm customizing: ```php public function searchBox(): SearchBox { return Theme::searchBox() ->input('eewfewfwef') ->iconClose('text-pg-primary-400 dark:text-pg-primary-200') ->iconSearch('text-pg-primary-300 mr-2 w-5 h-5 dark:text-pg-primary-200'); } ``` and if it's in my class - nothing happened. image changing to the default theme and customize in the vendor folder - works great image I did everything as in the instructions. Any ideas? Laravel 10.48 and Last PowerGrids
luanfreitasdev commented 6 months ago

https://github.com/Power-Components/livewire-powergrid/discussions/1477#discussioncomment-8996533