question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] First Filter Appears and Won't Go Away When Selecting Any Other Filter

See original GitHub issue

Bug report

What I did

I added the following filters to my Crud Controller within the setup() method.

$this->crud->addFilter([
            'name'  => 'invite_state',
            'type'  => 'dropdown',
            'label' => 'State'
        ], [
            0 => 'Invite Sent',
            1 => 'Accepted Terms',
            2 => 'Payment Provided',
            3 => 'Approved',
        ], function ($value) { // if the filter is active
            $this->crud->addClause('where', 'invite_state', $value);
        });

        $this->crud->addFilter(
            [
                'name'  => 'event_description',
                'type'  => 'select2',
                'label' => 'Event Code'
            ],
            function () {
                return \App\Models\HTOEvent::select('code', 'id')
                    ->whereExists(function ($query) {
                        $query->select(DB::raw(1))->from('hto_event_sponsors')->whereRaw('hto_event_id = hto_events.id');
                    })
                    ->get()->pluck('code', 'id')->toArray();
            },
            function ($value) {
                $this->crud->addClause('where', 'hto_event_id', $value);
            }
        );

        $this->crud->addFilter(
            [
                'name'  => 'account_description',
                'type'  => 'select2',
                'label' => 'Account'
            ],
            function () {
                return \App\Models\HTOAccount::select('company', 'id')
                    ->whereExists(function ($query) {
                        $query->select(DB::raw(1))->from('hto_event_sponsors')->whereRaw('hto_account_id = hto_accounts.id');
                    })
                    ->get()->pluck('company', 'id')->toArray();
            },
            function ($value) {
                $this->crud->addClause('where', 'hto_account_id', $value);
            }
        );
        

What I expected to happen

I expect to be able to use any of the filters without unwanted issues.

What happened

In this case if I select an option for the Event Code or the Account filter after I do so the State filters drop down list will show up. Once this happens I can not get the States drop down list to disappear without refreshing the page. Even if I clear the filters or select a State filter it will not go away.

What I’ve already tried to fix it

I’ve updated to the latest backpack version. I’ve removed the State filter to see if this problem then happens with the Event Code filter. It does. So it is not specific to a filter it’s just the fact that there are multiple filters on this page.

Backpack, Laravel, PHP, DB version

PHP VERSION:

PHP 7.3.15-3+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Feb 23 2020 07:23:33) ( NTS ) Copyright © 1997-2018 The PHP Group Zend Engine v3.3.15, Copyright © 1998-2018 Zend Technologies with Xdebug v2.9.8, Copyright © 2002-2020, by Derick Rethans with Zend OPcache v7.3.15-3+ubuntu18.04.1+deb.sury.org+1, Copyright © 1999-2018, by Zend Technologies

LARAVEL VERSION:

v7.30.4@9dd38140dc2924daa1a020a3d7a45f9ceff03df3

BACKPACK VERSION:

4.1.42@9338f9711a393f82ecb09d68c0756bf24c56eafe

Screen Shot 2021-04-20 at 11 15 30 AM

Screen Shot 2021-04-20 at 11 15 34 AM

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
selected-pixel-jamesoncommented, Apr 28, 2021

@pxpm As always really appreciate your help. It’s very apparent that you care about your platform and are passionate about it. Thank you!

0reactions
selected-pixel-jamesoncommented, Apr 28, 2021

@pxpm Thanks for the heads up. We are only using this app as an admin. There is no front-end so we are all good there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Excel filter not working after a certain row - AuditExcel
The easiest way to correct this mistake is, even if the filter is already on,. highlight all the cells you want to include,;...
Read more >
Clear or remove a filter - Microsoft Support
Remove all the filters in a worksheet. If you want to completely remove filters, go to the Data tab and click the Filter...
Read more >
5 Reasons why your Excel filter may not be working
Check that a filter hasn't been left on another column. The best way to clear all of the filters is to click the...
Read more >
Filters disappear | WordPress.org
Issue = when I make a selection in 1 filter of a group the others disappear. I can make a selection in each...
Read more >
[9 Fixes] For Filter Not Working In Excel Problem
Check that your filter is not been left on any other column. The best option for clearing up all the Excel filters is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found