Table action modal not showing up for some records

Hi everyone! As the title says, I have this table in a Resource's custom page.
public function table(Table $table): Table
{
return $table
->query($this->getTableQuery())
->columns([
TableComponents::itemNameColumn()->searchable(),
// other columns
])
->actions([
TableActions::batchOutAction(),
Action::make('test')->action(fn(Model $record) => dd($record)),
]);
}
public function getTableQuery()
{
return TableQueries::outgoingQuery();
}
public function table(Table $table): Table
{
return $table
->query($this->getTableQuery())
->columns([
TableComponents::itemNameColumn()->searchable(),
// other columns
])
->actions([
TableActions::batchOutAction(),
Action::make('test')->action(fn(Model $record) => dd($record)),
]);
}
public function getTableQuery()
{
return TableQueries::outgoingQuery();
}
The is the TableQueries::outgoingQuery().
public static function outgoingQuery()
{
return Transaction::query()
->selectRaw('min(id) as id, item_id, category_id, subcategory_id, exp_date, batch, donor_id, project_id, SUM(amount) as amount, warehouse_id')
->groupBy('item_id', 'category_id', 'subcategory_id', 'exp_date', 'batch', 'donor_id', 'project_id', 'warehouse_id')
->havingRaw('SUM(amount) > 0');
}
public static function outgoingQuery()
{
return Transaction::query()
->selectRaw('min(id) as id, item_id, category_id, subcategory_id, exp_date, batch, donor_id, project_id, SUM(amount) as amount, warehouse_id')
->groupBy('item_id', 'category_id', 'subcategory_id', 'exp_date', 'batch', 'donor_id', 'project_id', 'warehouse_id')
->havingRaw('SUM(amount) > 0');
}
1 Reply
Ye Thi Ha Htwe
Ye Thi Ha HtweOP5d ago
My existing table action is to open a modal accessing the existing values from each aggregated row through fn(Model $record) closure. While the action works with almost every row, I have encountered in at least 2 records where the table action triggers nothing rather than a loading indicator. Then I added another action for testing purposes: Action::make('test')->action(fn(Model $record) => dd($record)),. This also dd'ed most of the rows but failed for the same 2 rows. I tried getTableRecordKey(), querying with min(id) and max(id) but no luck. Raw SQL queries through mysql cli or phpMyAdmin returned id columns without a null value. max(id) and min(id) actually did returned an id value for these two items causing the error so far. By the way, I use Cloudflare for the website, and some existing discussions on the internet say it might be related to cloudflare's minify HTML feature. But I don't see this setting on Cloudflare and they say this setting is deprecated. Please guide me find the cause of this error.

Did you find this page helpful?