Closed antonishv closed 1 year ago
Hmm. I can't seem to replicate the error.
Select::make('remark')
->label('Keterangan')
->options([
'Test' => 'Test',
'Test 2' => 'Test 2',
'Test 3' => 'Test 3',
])
->reactive()
->required(),
Select::make('wms_warehouse_id')
->label('Warehouse')
->options([
'1' => 'Warehouse 1',
'2' => 'Warehouse 2',
'3' => 'Warehouse 3',
])
->reactive()
->hidden(fn (callable $get) => $get('remark') == 'Test')
->required(fn (callable $get) => $get('remark') == 'Test')
->disabled(fn (callable $get) => $get('remark') != 'Test'),
Also, since this is an actual table I would reconsider using hidden fields since they will break the table layout as you can see in the screen shot.
I am having the same error
TableRepeater::make('scans')
->label('')
->schema([
Select::make('scan_id')
->label('Scan')
->native('false')
->searchable()
->live()
->options(
Scan::all()->pluck('name', 'id')->toArray()
)
->required(),
TextInput::make('count')
->required()
->numeric(),
TextInput::make('description')
->label('Scan Description')
->placeholder('eg. CT Chest and Abdomen')
->visible(function (Get $get) {
return $get('scan_id') == 1;
})
->required(function (Get $get) {
return $get('scan_id') == 1;
})
->columnspan(2),
])
->hidelabels()
->withoutHeader()
->columns(2)
->addActionLabel('Add a scan')
->reorderable(false)
->grid(2)
->defaultItems(0),
Throws error: Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization
It's something to do with the $get function inside visible and required. If I change them to return true or false, it all works.
Also if I change to use the standard Repeater filament component with the same config it all works fine.
Fixed if I remove ->defaultItems(0). So its a problem when you don't want any items to be shown by default. However this does work with the normal Filament Repeater and defaultItems set to 0.
got below error when chaining hidden method to tablerepeater