mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Fix select2 re-renders
This commit is contained in:
parent
f03249898a
commit
2eaac3d381
|
@ -644,8 +644,8 @@ document.addEventListener('livewire:init', () => {
|
||||||
Livewire.find(target.data('livewire-component')).set(event.target.name, this.options[this.selectedIndex].value)
|
Livewire.find(target.data('livewire-component')).set(event.target.name, this.options[this.selectedIndex].value)
|
||||||
});
|
});
|
||||||
|
|
||||||
Livewire.hook('commit', function ({succeed}) {
|
Livewire.hook('request', ({succeed}) => {
|
||||||
succeed(({snapshot, effect}) => {
|
succeed(() => {
|
||||||
queueMicrotask(() => {
|
queueMicrotask(() => {
|
||||||
$('.livewire-select2').select2();
|
$('.livewire-select2').select2();
|
||||||
});
|
});
|
||||||
|
|
|
@ -153,6 +153,7 @@
|
||||||
<div class="col-md-9 col-xs-12" wire:ignore>
|
<div class="col-md-9 col-xs-12" wire:ignore>
|
||||||
{{ Form::select('activeFile.import_type', $importTypes, $activeFile->import_type, [
|
{{ Form::select('activeFile.import_type', $importTypes, $activeFile->import_type, [
|
||||||
'id' => 'import_type',
|
'id' => 'import_type',
|
||||||
|
'class' => 'livewire-select2',
|
||||||
'style' => 'min-width: 350px',
|
'style' => 'min-width: 350px',
|
||||||
'data-placeholder' => trans('general.select_var', ['thing' => trans('general.import_type')]),
|
'data-placeholder' => trans('general.select_var', ['thing' => trans('general.import_type')]),
|
||||||
'placeholder' => '', //needed so that the form-helper will put an empty option first
|
'placeholder' => '', //needed so that the form-helper will put an empty option first
|
||||||
|
@ -227,7 +228,7 @@
|
||||||
|
|
||||||
{{ Form::select('field_map.'.$index, $columnOptions[$activeFile->import_type], @$field_map[$index],
|
{{ Form::select('field_map.'.$index, $columnOptions[$activeFile->import_type], @$field_map[$index],
|
||||||
[
|
[
|
||||||
'class' => 'mappings',
|
'class' => 'mappings livewire-select2',
|
||||||
'placeholder' => trans('general.importer.do_not_import'),
|
'placeholder' => trans('general.importer.do_not_import'),
|
||||||
'style' => 'min-width: 100%',
|
'style' => 'min-width: 100%',
|
||||||
'data-livewire-component' => $this->getId()
|
'data-livewire-component' => $this->getId()
|
||||||
|
|
Loading…
Reference in a new issue