MedicOneSystems / MedicOneSystems/livewire-datatables

Checkbox used in query builders causes error in order by ('id' is ambiguous).

Open
#526 1 comment 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

Hi,

I am trying to build a simple article table that involves a few joins and also allows checkboxes for mass operations.

image

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

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

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".
image

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:
image

Then it works perfectly.

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.