tommy_jeanslow
JSON TextColumn formatStateUsing badge repeats
It repeats the badge. In this case "Attachments".
If the column is null, nothing displays. If there is one array within the json, one badge displays. If there are two arrays, two display, etc, etc.
7 replies
Error using $rowLoop
Thank you. I did know about HasTable, I had omitted it from the file while I was testing.
I also elimited order.
I believe I have it all working. There is one odd behaviour. It gives an error about $livewire->getTableRecordsPerPage not being an int when "all" is selected.
I have a workaround, although pretty crude...I'm sure there is a much cleaner way to do this, unless I am doing something wrong altogether here and a fix is not needed? 😕 😕
static function (stdClass $rowLoop, HasTable $livewire): string { if($livewire->tableRecordsPerPage == 'all') { $tableRecordsPerPage = 9999; } else { $tableRecordsPerPage = $livewire->tableRecordsPerPage; } return (string) ($rowLoop->iteration + ($tableRecordsPerPage * ($livewire->paginators['page'] - 1 )) ); }
static function (stdClass $rowLoop, HasTable $livewire): string { if($livewire->tableRecordsPerPage == 'all') { $tableRecordsPerPage = 9999; } else { $tableRecordsPerPage = $livewire->tableRecordsPerPage; } return (string) ($rowLoop->iteration + ($tableRecordsPerPage * ($livewire->paginators['page'] - 1 )) ); }
11 replies
Error using $rowLoop
Sorry about that.
This is right from the example on a fresh resource that I just created with one relationship.
This is the only column other than the ID.
TextColumn::make('index')->getStateUsing(
static function (stdClass $rowLoop, HasTable $livewire): string {
return (string) (
$rowLoop->iteration +
($livewire->getTableRecordsPerPage * (
$livewire->page - 1
))
);
}
),
11 replies