MedicOneSystems / MedicOneSystems/livewire-datatables

Bug addSort

Open
#609 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.2k
Forks
257
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open src/Http/Livewire/LivewireDatatable.php at the referenced line and inspect how addSort builds its orderBy expression, including the query's from table and pinned records. Compare the current relation handling with the expression shown in the issue. Done means pinned records remain correctly ordered when additional relations are used.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.