Refactor PlantResource table to remove commented 'id' column and enhance 'id' column with label, alignment, sorting, and searchability options

This commit is contained in:
dhanabalan
2025-11-08 12:49:24 +05:30
parent b7a8c933ff
commit ec1dfe0146

View File

@@ -153,10 +153,6 @@ class PlantResource extends Resource
{
return $table
->columns([
// Tables\Columns\TextColumn::make('id')
// ->label('ID')
// ->numeric()
// ->sortable(),
Tables\Columns\TextColumn::make('No.')
->label('No.')
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
@@ -164,7 +160,15 @@ class PlantResource extends Resource
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
})
->toggleable(isToggledHiddenByDefault: false),
Tables\Columns\TextColumn::make('id')
->label('ID')
->numeric()
->alignCenter()
->sortable()
->searchable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('code')
->label('Code')
->alignCenter()