filament icon indicating copy to clipboard operation
filament copied to clipboard

Attribute with name length is not giving the desired output when using ->searchable(isIndividual: true)

Open Geoffry304 opened this issue 1 year ago • 1 comments

Package

filament/filament

Package Version

v3.2.130

Laravel Version

v.11.35.0

Livewire Version

No response

PHP Version

PHP 8.3

Problem description

When you have an attribute named length in the database and you use the ->searchable(isIndividual: true) in the tables of filament you get a zero in the search field and the search field is not working. When deleting the zero to filter, the zero keeps coming back.

image

Expected behavior

That the zero is not there and that I am able to filter individual on an attribute named length.

Steps to reproduce

  1. Create a table with a column that is named length with type integer or float
  2. Create a standard resource of the model
  3. Make the column length individual searchable
public static function table(Table $table): Table
    {
        return $table
            ->columns([
                Tables\Columns\TextColumn::make('id')
                    ->label('ID'),
                Tables\Columns\TextColumn::make('length')
                    ->suffix(' mm')
                    ->searchable(isIndividual: true)
                    ->sortable(),
                Tables\Columns\TextColumn::make('total_meters')
                    ->suffix(' m')
                    ->sortable(),
                Tables\Columns\TextColumn::make('supplier_reference')
                    ->label('Reference')
                    ->sortable(),
            ])
            ->filters([
                //
            ])
            ->actions([
                Tables\Actions\EditAction::make(),
            ])
            ->bulkActions([
                Tables\Actions\BulkActionGroup::make([
                    Tables\Actions\DeleteBulkAction::make(),
                ]),
            ]);
    }

Reproduction repository (issue will be closed if this is not valid)

https://github.com/Geoffry304/filament-length-attribute-issue

Relevant log output

No response

Geoffry304 avatar Dec 12 '24 14:12 Geoffry304

Probably something to do with .length being a common property in JS land

danharrin avatar Dec 14 '24 08:12 danharrin