Open inZaneX opened 7 months ago
https://github.com/MedicOneSystems/livewire-datatables/blob/cfb4d800e39df96202564fe947e6046e6b8c52c1/src/Http/Livewire/LivewireDatatable.php#L1607C54-L1607C56
it should look like this:
$this->query->orderBy(DB::raw('FIELD('.$this->query->from.'.id,' . implode(',', $this->pinnedRecords) . ')'), 'DESC');
'.$this->query->from.'
id
Otherwise it could stop working if you use more relations
https://github.com/MedicOneSystems/livewire-datatables/blob/cfb4d800e39df96202564fe947e6046e6b8c52c1/src/Http/Livewire/LivewireDatatable.php#L1607C54-L1607C56
it should look like this:
$this->query->orderBy(DB::raw('FIELD(
'.$this->query->from.'
.id
,' . implode(',', $this->pinnedRecords) . ')'), 'DESC');Otherwise it could stop working if you use more relations