Open sukronsabari opened 10 hours ago
This is field function:
public bool $deferLoading = true; public string $loadingComponent = 'components.loading.datatable-loading';
public function fields(): PowerGridFields { return PowerGrid::fields() ->add('id') ->add('main_image', function(Product $row) { $mainImage = $row->images->where('is_main', true)->first();
if ($mainImage) {
return '<img src="' . asset('storage/' . $mainImage->image) . '" alt="Main Image" class="h-20 object-cover rounded">';
}
return 'No Image';
})
->add('name')
->add('description')
->add('is_active')
->add('currency_code')
->add('price', fn(Product $row) => Number::currency($row->price, 'IDR', 'id_ID'))
->add('stock')
->add('weight', fn(Product $row) => (int) $row->weight)
->add('sku')
->add('has_variation')
->add('created_at')
->add('updated_at');
}
Have you searched through other issues to see if your problem is already reported or has been fixed?
Yes, I did not find it.
Did you read the documentation?
Yes, I did not find it.
Have you tried to publish the views?
Yes - I didn't work.
Is there an error in the console?
PHP Version
8.3.8
PowerGrid
5.10.6
Laravel
11.21.0
Livewire
3,5,6
Alpine JS
3.4.2
Theme
Tailwind 3.x
Describe the bug.
When attempting to use more than a specific number of columns in the columns() function of PowerGrid, a critical issue arises. Un-commenting certain columns consistently causes a JSON parsing error, which prevents the table from rendering correctly and results in deferred loading (wire:loading) not completing.
Error Details: When the total number of columns exceeds a certain threshold, the following error appears in the console: Uncaught (in promise) SyntaxError: Unexpected token '<', ")
at sendRequest (livewire.js?id=cc800bf4:4321:52)
at async RequestPool.send (livewire.js?id=cc800bf4:4041:7)
The deferred loading state never ends for the PowerGrid table when this error occurs.
"... is not valid JSON at JSON.parse (
To Reproduce...
Extra information