Widget error $tableColumnSearches
Hi everyone,
Im having a issue thats driving me nuts...
Im trying to make a widget update depending on what I choose from the table filter but I keep getting this issue everytime I change the filter on the table
On my AnalyticsResource I have ExposesTableToWidgets
and also included the
on the AnalyticStats I have use InteractsWithPageTable;
looks like this
All im trying to do is filter the count depending on the filter between dates, Ive pretty much duplicated whats on the demo project.
Any help would be great..
Thanks in advance
7 Replies
Can you share the full Flare error.
I assume it's coming from line 75 in InteractsWithPageTable, but would help to be sure.
FWIW i'm getting the same issue. I tried going through it with the debugger and it never hits the
InteractsWithPageTable::getTablePageInstance()
method. I might be missing something though.
here is a repo that has the minimum code to reproduce it : https://github.com/sprtk-ches/laravel-filament
Once you migrate + seed + build and navigate to /users
you can just type anything in search and it will trigger the error
Might raise a ticket for this 🤔Sorry been away on a trip, ill see if I can grab the full flare error once I get the project up and running..
@ChesterS Thats the issue im having at the moment, I might update to the latest version of filament and see if its still an issue, atleast im not alone on this problem ahah
@Wazza FWIW adding
public array $tableColumnSearches = [];
to the widget class (AnalyticStats
) seems to solve the issue.
However I've found another issue where getPageTableQuery()
and getPageTableRecords()
don't return the correct results based on the filters that are activeHere is the flare @Hugh Messenger https://flareapp.io/share/x7Kbk8eP#context-request-browser
@Hugh Messenger That fixes the error but you are right is causes the normal filter to break
Flare
Cannot assign null to property App\Filament\Resources\AnalyticResource\Widgets\AnalyticStats::$tableColumnSearches of type array - The error occurred at http://localhost/admin/analytics
The normal filter is broken even without that. You can test it yourself
1.
getPageTableRecords()
returns more results than the actual total of the page
2. getPageTableQuery()
ignores the filters. You can test that by adding some default filters - if you count()
the query results, you'll see that your total is more than it should.
In any case, there's something wrong there and it's easily reproducibleOkay so I managed to fix it, I made a mistake on where I was adding the logic
So use ExposesTableToWidgets; needs to be in the ListAnalytics
I had mine on the AnalyticsResource