-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MapTableWidget not reacting to Table Radius Filter - Flickers and re-centers #95
Comments
Same issue, you figure out the solution? |
Not yet, but will be trying next week as I will need mapping capabilities in the next app I'm building. |
I ended up figuring it out partially. I had to override the filter with my own class and add the <?php
namespace App\Filters;
use Cheesegrits\FilamentGoogleMaps\Fields\Geocomplete;
use Filament\Forms\Components\Fieldset;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
class RadiusFilter extends \Cheesegrits\FilamentGoogleMaps\Filters\RadiusFilter
{
public function getFormSchema(): array
{
$form = [
Group::make()->schema([
Geocomplete::make('geocomplete')
->label(__('filament-google-maps::fgm.radius_filter.address'))
->filterName($this->getName())
->updateLatLng()
->lazy(),
Group::make()->schema([
TextInput::make('radius')
->label(__('filament-google-maps::fgm.radius_filter.distance'))
->numeric()
->default($this->getRadius() ?? 10)
->lazy(),
Select::make('unit')
->label(__('filament-google-maps::fgm.radius_filter.unit'))
->options([
'mi' => __('filament-google-maps::fgm.radius_filter.miles'),
'km' => __('filament-google-maps::fgm.radius_filter.kilometers'),
])
->default(
$this->getKilometers() ? 'km' : 'mi'
)
->visible(fn () => $this->getSelectUnit()),
])
->columns($this->getSelectUnit() ? 2 : 1),
Group::make()->schema([
Hidden::make('latitude'),
Hidden::make('longitude'),
]),
])
->columnSpan('full'),
];
if ($this->hasSection()) {
$form = [
Fieldset::make($this->getSection())->schema($form),
];
}
return $form;
}
private function hasSection(): bool
{
return ! empty($this->getSection());
}
} |
The MapTableWidget isn't reacting to the Location Radius Filter in the table. I have been able to reproduce this issue in both the Location Resource from the test project repository < https://github.com/cheesegrits/fgm > and when I implement the MapTableWidget in my personal project.
Steps to Reproduce
class LocationMapTableWidget extends MapTableWidget
{
protected static ?string $heading = 'Location Map';
When the page is rendered it appears fine, the map shows locations for the records in the table.
Attempt to filter the table using the address of the first record that appears in the table. The table doesn't react and stays the same. The map flickers then recenters to a default location.
You can't reset the filter you need to refresh the entire web page to get back to the default state when the page first loads.
The text was updated successfully, but these errors were encountered: