Open Slobug opened 2 years ago
the same issue. please @marksalmon look at this
@marksalmon @thyseus @tomshaw @trippo please help
when exporting datatable, there is error "Unknown column", and no JOINS in query
the same issue. please @marksalmon look at this
@Slobug @arlanram @mansiprajapati I need to narrow down the issue. There's no way I can reproduce the error without more detail. I haven't looked at the library in a while so I downloaded the latest Laravel/Jetstream Livewire. Factoried a few hundred users. Cloned the latest livewire-data tables and created a user grid. I was unable recreate any errors.
@tomshaw Try to add a relation column in the data table and export the data this way you can regenerate this error
@mansiprajapati Can I see your column type.
I have found out that export didn't work for me for same reasons as long as I was using public $model, but when I used the query builder, it worked. Does that help?
I have found out that export didn't work for me for same reasons as long as I was using public $model, but when I used the query builder, it worked. Does that help?
I @nathcast ,
Thank you very much for your help. I had to put my problem on hold but thanks to you and a little digging through the code in the vendor folder, I was able to solve my problem.
If it helps anyone, if you want a custom export :
add : use Illuminate\Support\Facades\DB;
public $exportable = false; public $customexportable = true;
with this, the "export" button will return to a custom function "customexport".
` public function customexport() {
$data = DB::table('table1')
->select(
'table1.column',
'table1.columNameLikeTable2 AS otherName_a',
'table2.discipline',
'table2.columNameLikeTable1 AS otherName_b',
)
->leftJoin('table2', 'table2.id', '=', 'table1.user_id')
->get();
$export = new DatatableExport($data);
return $export->download();
}`
Hi
when I export some datatable I have this message:
SQLSTATE[42S22]: Column not found: 1054 Unknown column
The column is a relation like : post.name
My config
someone to help me ? ;)