Power-Components / livewire-powergrid

⚡ PowerGrid generates modern, powerful and easy-to-customize data tables using Laravel Livewire.
https://livewire-powergrid.com
MIT License
1.46k stars 215 forks source link

Error exporting data #196

Closed diegoba73 closed 2 years ago

diegoba73 commented 2 years ago

When I want to export filtered data, it throws me the following error:

Captura de Pantalla 2021-12-22 a la(s) 00 00 57

luanfreitasdev commented 2 years ago

This could happen because of the way the join was assembled.

https://livewire-powergrid.docsforge.com/main/datasource/#join-tables

diegoba73 commented 2 years ago

I made the change and it works perfect, it is seen that this is the problem with respect to the id. What if making that change now changes the fields of the booleans and does not make them toggleable, which can be the problem with the latter. If I remove the "primaryKey" thing it works again. Very rare

luanfreitasdev commented 2 years ago

Did this work on version 1.5.1 or on the alpine3 branch? Can you explain better about the primaryKey?

diegoba73 commented 2 years ago

The export function works when I add these 2 lines:

public string $primaryKey = 'muestras.id';
public string $sortField = 'muestras.id';

But the toggleable buttons disappear:

Captura de Pantalla 2021-12-24 a la(s) 03 11 57

luanfreitasdev commented 2 years ago

This is because it is not yet safe to update with this type of primary key. I'll investigate

luanfreitasdev commented 2 years ago

Unfortunately for now this is not possible because it handles the column dynamically, for example: column 'id' = $row->{$id} = $row->id. I haven't seen an output so far to use with joins. Example: $row->{$id} = $row->dishes.id

pauleniz commented 2 years ago

Is it possible to export filtered data without checkboxes? maybe there could be export options: all / filtered / selected(checked) filtered export could take the same query but without pagination or is it possible to assign an array to a variable like $this->exportData= $data;