MedicOneSystems / MedicOneSystems/livewire-datatables

Incorrect results when using simple array in filterable method.

Open
#306 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

Using the code below produces the correct filter but not the corresponding string value in the grid results. If you use the column callback method the closure never returns the correct value.

Column::name('status')->label('Status')->filterable(['New', 'Approved, 'Seen', 'Completed'])

The following code returns the wrong value.

Column::callback('status', function ($value) {
  return $value;
})->label('Status')->filterable(['New', 'Approved, 'Seen', 'Completed']),

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 by reproducing the two snippets using Column::name, Column::callback, and filterable with the listed status values. Trace how the filter selection and callback value reach the grid results; done means filtering still works and the displayed status value matches the selected record.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
full-stack
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.