Maxxx22
Maxxx22
FFilament
Created by Maxxx22 on 4/12/2023 in #❓┊help
Reactive table filters without Livewire request
Ok, thanks anyway
4 replies
FFilament
Created by Maxxx22 on 4/12/2023 in #❓┊help
Customize table default search debounce behavior
Hmm, I could start customizing filament\vendor\filament\tables\resources\views\components\search-input.blade.php and so on creating a MR, would that be something that would work or even be appreciated?
6 replies
FFilament
Created by Maxxx22 on 4/12/2023 in #❓┊help
Customize table default search debounce behavior
Nice idea.. should have thought of it myself, Any Ideas about the lazy/debounce behavior too?
6 replies
FFilament
Created by Maxxx22 on 4/12/2023 in #❓┊help
Reactive table filters without Livewire request
4 replies
FFilament
Created by John on 3/6/2023 in #❓┊help
Filter with recursive relationship
I am currently stuck on the same topic. I used https://filamentphp.com/tricks/dependent-select-filters for help, but I am not sure if the value of the filter option should be retrieved from the DB again? Is there a possibility to retrieve it from existing select options data?
Foundation::find($data['foundation'])->organisation
Foundation::find($data['foundation'])->organisation
I see SelectFilter is doing something like this:
$this->indicateUsing(function (SelectFilter $filter, array $state): array {
if ($filter->isMultiple()) {
if (blank($state['values'] ?? null)) {
return [];
}

$labels = Arr::only($this->getOptions(), $state['values']);
$this->indicateUsing(function (SelectFilter $filter, array $state): array {
if ($filter->isMultiple()) {
if (blank($state['values'] ?? null)) {
return [];
}

$labels = Arr::only($this->getOptions(), $state['values']);
But how to access the option from within indicateUsing?
13 replies
FFilament
Created by Maxxx22 on 3/3/2023 in #❓┊help
How do I refresh select options when I generate new options within the same wizard
I am still not sure how this is working internally but the following example is working
protected function getSteps(): array
{
return [
Step::make('Enter Mandatory Fields')
->schema([
TextInput::make('name')
->default('dummy_name_'.date('his')),
TextInput::make('gps_lat')
->default(random_int(10,80)),
TextInput::make('gps_long')
->default(random_int(10,150)),
])
->afterValidation(function (Closure $set, $get) {
$set('region_id', Region::getRegionId($get('gps_lat'), $get('gps_long')));
})
->afterStateUpdated(function (Closure $set, $get) {
$set('region_id', Region::all()->pluck('name', 'id')->toArray());
}),
Step::make('Check autogenerated values')
->schema([
Select::make('region_id')
->relationship('region', 'name')
->label('Region (calculated by GPS data)')
->reactive()
->required(),
]),
];
}
protected function getSteps(): array
{
return [
Step::make('Enter Mandatory Fields')
->schema([
TextInput::make('name')
->default('dummy_name_'.date('his')),
TextInput::make('gps_lat')
->default(random_int(10,80)),
TextInput::make('gps_long')
->default(random_int(10,150)),
])
->afterValidation(function (Closure $set, $get) {
$set('region_id', Region::getRegionId($get('gps_lat'), $get('gps_long')));
})
->afterStateUpdated(function (Closure $set, $get) {
$set('region_id', Region::all()->pluck('name', 'id')->toArray());
}),
Step::make('Check autogenerated values')
->schema([
Select::make('region_id')
->relationship('region', 'name')
->label('Region (calculated by GPS data)')
->reactive()
->required(),
]),
];
}
Thanks 🙂
7 replies
FFilament
Created by Maxxx22 on 3/3/2023 in #❓┊help
How do I refresh select options when I generate new options within the same wizard
Hmm, I tried to using afterStateUpdated before but it seemed not to be working. If I change afterValidation to afterStateUpdated for example even the ID of the select element is updated. How could I set the select options using $set, could you privide an example?
protected function getSteps(): array
{
return [
Step::make('Enter Mandatory Fields')
->schema([
TextInput::make('name')
->default('dummy_name_'.date('his')),
TextInput::make('gps_lat')
->default(random_int(10,80)),
TextInput::make('gps_long')
->default(random_int(10,150)),
])
/*->afterValidation(function (Closure $set, $get) {
$set('region_id', Region::getRegionId($get('gps_lat'), $get('gps_long')));
})*/
->afterStateUpdated(function (Closure $set, $get) {
$set('region_id', Region::getRegionId($get('gps_lat'), $get('gps_long')));
}),
Step::make('Check autogenerated values')
->schema([
Select::make('region_id')
->relationship('region', 'name')
->label('Region (calculated by GPS data)')
->options(Region::all()->pluck('name', 'id')->toArray())
->required(),
]),
];
}
protected function getSteps(): array
{
return [
Step::make('Enter Mandatory Fields')
->schema([
TextInput::make('name')
->default('dummy_name_'.date('his')),
TextInput::make('gps_lat')
->default(random_int(10,80)),
TextInput::make('gps_long')
->default(random_int(10,150)),
])
/*->afterValidation(function (Closure $set, $get) {
$set('region_id', Region::getRegionId($get('gps_lat'), $get('gps_long')));
})*/
->afterStateUpdated(function (Closure $set, $get) {
$set('region_id', Region::getRegionId($get('gps_lat'), $get('gps_long')));
}),
Step::make('Check autogenerated values')
->schema([
Select::make('region_id')
->relationship('region', 'name')
->label('Region (calculated by GPS data)')
->options(Region::all()->pluck('name', 'id')->toArray())
->required(),
]),
];
}
7 replies