[Bug] First Filter Appears and Won't Go Away When Selecting Any Other Filter
See original GitHub issueBug 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


Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (5 by maintainers)

Top Related StackOverflow Question
@pxpm As always really appreciate your help. It’s very apparent that you care about your platform and are passionate about it. Thank you!
@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.