Closed vivekmarakana closed 7 years ago
How you solved this issue?
New version of select2 library has changed few function name and dropped few. So I just changed names and removed dropped functionality from this plugin.
Any chance to post your working codes please? It will help a lot of people!
maybe this link could help you.. https://github.com/rburakov/yii2-dynamicform/commit/d7d596be71bbc6f7c81a457b40634630ac35eef7
try with this version in your composer:
"wbraganca/yii2-dynamicform": "2.0.2",
"kartik-v/yii2-widget-select2": "1.0.0"
You can also use my forked package for this:
"vivekmarakana/yii2-dynamicform": "dev-master",
You can find it here: https://github.com/vivekmarakana/yii2-dynamicform
@markmarco16 that solves the problem, thanks.
@marcoadasilvaa solution worked, But got another error
Setting unknown property: kartik\select2\Select2::initValueText
to get this error solved you have to change the yii2-dynamic-form.js in the src/asstes folder
change row 458 from
$.when($('#' + id).select2(configSelect2)).done(initSelect2Loading(id, '.select2-container--krajee'));
to
$.when($('#' + id).select2(configSelect2)).done(initS2Loading(id, '.select2-container--krajee'));
and row 463 from
initSelect2DropStyle(id, kvClose, ev);
to
initS2Loading(id, kvClose, ev);
BR MaGiCmAsTeR0511
A solução de @vivekmarakana funcionou muito bem para mim! Obrigado a todos
Monkey-patching the files in vendor/
is discouraged as it will break on a composer update
.
I suggest the following solution in your view file(s)
$this->registerJs('
function initSelect2DropStyle(a,b,c){
initS2Loading(a,b,c);
}
function initSelect2Loading(a,b){
initS2Loading(a,b);
}
',
yii\web\View::POS_HEAD
);
It provides an alias to the missing functions by injecting the JS code in the head section of the generated HTML.
@DBX12 thanks, your solution works, But, for newbies here is the full example:
` namespace components;
use yii\web\View;
class DynamicFormWidget extends \wbraganca\dynamicform\DynamicFormWidget
{
protected function registerOptions($view)
{
parent::registerOptions($view);
$view->registerJs(
'
function initSelect2DropStyle(a,b,c){
initS2Loading(a,b,c);
}
function initSelect2Loading(a,b){
initS2Loading(a,b);
}
',
View::POS_HEAD
);
}
}
`
to get this error solved you have to change the yii2-dynamic-form.js in the src/asstes folder
change row 458 from
$.when($('#' + id).select2(configSelect2)).done(initSelect2Loading(id, '.select2-container--krajee'));
to$.when($('#' + id).select2(configSelect2)).done(initS2Loading(id, '.select2-container--krajee'));
and row 463 from
initSelect2DropStyle(id, kvClose, ev);
toinitS2Loading(id, kvClose, ev);
BR MaGiCmAsTeR0511
This worked for me. Thank you
I get this error when I click on the plus button.