Closed idencial closed 4 years ago
Check if it is resolved with the latest fix? Else will reopen.
In packagist the last available version is 2.1.6. Please refresh to 2.1.7. Thanks.
The latest release is not tagged yet (pending confirmations from few) - once it is tagged it will appear on packagist. Till then you can use the code from dev-master
I updated to the latest version of the module and have problem with default values (when edit some object) for the case when using ajax
That is, I have a non-empty value initValueText, as well as a non-empty value for the field where it is used select2, but when I opened the edit page with this select2 field, no default value selected
i found a problem It turned out that the problem is in this line of code
$this->data = $multiple ? array_combine((array)$key, (array)$val) : (($emptyPH && $key !== '') ? [$key => $val] : []);
The problem is that the condition is $emptyPH must be true That is, the initial values will be substituted only if in options are not specified placeholder I temporarily solved the problem like thisif (empty($place_name)) { $select2_place_options = ['placeholder' => 'Choose a place ...', 'multiple' => false]; } else { $select2_place_options = ['multiple' => false]; }
Ie when I have a non-empty value for'initValueText' => $place_name
, I dont use placeholder in options Ie I have a question, why use condition for $emptyPH is true when not empty $key?