MedicOneSystems / MedicOneSystems/livewire-datatables
Checkbox used in query builders causes error in order by ('id' is ambiguous).
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 1.2k
- Forks
- 257
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I am trying to build a simple article table that involves a few joins and also allows checkboxes for mass operations.

The problem is, it is trying to order by the checkbox column and lands in an error:

A preliminary search leads me to this place in the library code:

I don't think the check is correct for the "name" there, and it should rather check after something else to know if it has to do with a checkbox or label. The name for my checkbox is for some reason "checkbox_attribute".

I found that this is set by default when a checkbox is created.
If I make the checkbox unsortable() and change this snippet here like this:

Then it works perfectly.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the library code referenced in the report and trace how checkbox columns receive the default name "checkbox_attribute" and become involved in ordering. Reproduce the joined article-table query with a sortable checkbox, then verify that it no longer produces an ambiguous "id" error while unsortable checkboxes remain supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- laravel, php
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100