After upgrading from v3.6 to v4.0 (v4.1) filters select2 and select2_ajax does not work
See original GitHub issueBug report
After upgrading from v3.6 to v4.0 filters select2 and select2_ajax does not work - it only shows empty area after click on it. When click on that empty area, it shows options, but close immediately. This bug is present in v4.0 and v4.1 too.
What I did
filter definition:
$this->crud->addFilter([ // select2 filter
'name' => 'id_outlay_center',
'type' => 'select2',
'label'=> trans('backpack::nou.outlay_center'),
], function() {
return \App\Models\Codelist\OutlayCenterActive::all()->pluck('outlay_center_with_code', 'id_outlay_center')->toArray();
}, function($value) { // if the filter is active
$this->crud->addClause('where', 'id_outlay_center', $value);
});
What I expected to happen
Show options for select2 or line to write characters in select2_ajax filters. ??
What happened
Show only empty area ??
What I’ve already tried to fix it
??
Backpack, Laravel, PHP, DB version
When I run php artisan backpack:version
the output is:
PHP VERSION:
PHP 7.2.10 (cli) (built: Sep 13 2018 00:48:27) ( ZTS MSVC15 (Visual C++ 2017) x64 ) Copyright © 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright © 1998-2018 Zend Technologies
LARAVEL VERSION:
v7.10.3@6e927e78aafd578d59c99608e7f0e23a5f7bfc5a
BACKPACK VERSION:
4.1.3@02988a0d14b09e55949781d729060df910f0d94b
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Update select2 data without rebuilding the control
Show activity on this post. I think it suffices to hand the data over directly: $("#inputhidden"). select2("data", data, true);
Read more >Add, select, or clear items | Select2 - The jQuery replacement ...
Programmatically adding, selecting, and clearing options in a Select2 control.
Read more >Common problems - The jQuery replacement for select boxes
Select2 does not function properly when I use it inside a Bootstrap modal. This issue occurs because Bootstrap modals tend to steal focus...
Read more >What's new in 4.0 - The jQuery replacement for select boxes
Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and pagination (infinite scrolling) of results.
Read more >Search | Select2 - The jQuery replacement for select boxes
Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and pagination (infinite scrolling) of results.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
UPDATE: It occurred to me to look into potential Bootstrap conflicts. I was already using Bootstrap v4 in my app.js which I had set up in my
config/base.php
to be included on my admin pages. When I commented that out of my config, the select2 filters started working again.Thanks for sharing your solution @trip-somers !