Refactor PlantResource table to remove commented 'id' column and enhance 'id' column with label, alignment, sorting, and searchability options
This commit is contained in:
@@ -153,10 +153,6 @@ class PlantResource extends Resource
|
|||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
->columns([
|
->columns([
|
||||||
// Tables\Columns\TextColumn::make('id')
|
|
||||||
// ->label('ID')
|
|
||||||
// ->numeric()
|
|
||||||
// ->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('No.')
|
Tables\Columns\TextColumn::make('No.')
|
||||||
->label('No.')
|
->label('No.')
|
||||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||||
@@ -164,7 +160,15 @@ class PlantResource extends Resource
|
|||||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
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')
|
Tables\Columns\TextColumn::make('code')
|
||||||
->label('Code')
|
->label('Code')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
|
|||||||
Reference in New Issue
Block a user