MedicOneSystems / MedicOneSystems/livewire-datatables

Reset fields button don't empty number filters

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

Hi,
When clicking on "Reset fields" button, the number filters are deactivated but the fields are not emptied. I tried some stuff without success like overriding some methods :

` public function clearAllFilters()
{
parent::clearAllFilters();
$this->emit('resetFilters');
$this->resetPage();
}

public function resetFilters() {
    //emptying all number filters
    foreach($this->columns() as $col) {
        $index = $this->getColumnIndexByName($col->name);
        if($col instanceof NumberColumn && sizeof($this->activeNumberFilters[$index]) > 0) {
            // howto empty filter number fields?
            
            // $this->removeNumberFilter($index);
            // $this->doNumberFilterStart($index, '');
            // $this->doNumberFilterEnd($index, '');
        }
    }
}`

Any idea?

Thank a lot

Marion

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 from clearAllFilters(), resetFilters(), and the NumberColumn number-filter methods shown in the issue. Reproduce clicking “Reset fields” with active number filters, then verify that the number fields are emptied as well as deactivated.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.