yii2-dynamicform
yii2-dynamicform copied to clipboard
bug in dynamicform when use kartik Select2
when added others form group , this issue is "ReferenceError: initSelect2Loading is not defined ", what is the problem?
In later versions of kartik-select2 he felt the need to change the external function names: initSelect2Loading -> initS2Loading initSelect2DropStyle -> initS2Open
I'm going to fork
This thread was very helpful! Now I would like to present my problem and maybe someone can give me a hint on how to solve it...
I have a modal with select2 and also dynamic form included in the modal which also includes select2.
The select2 in modal works until I use dynamic form and add another select2 through it. They still work but the search in them doesn't. (Curios is that when the dynamic form select2 is added, the other select2 from the modal has them same problem (search is disabled...)
Can anyone help me with this?
modal code :
http://pastebin.com/SL4FXzCS
_form :
http://pastebin.com/X4C5GdB4
Thank you!
Another comment about my problem with the modal/dynamic form/select2 is that if I don't go through the modal then everything works as it should...
Thank you !
try with this version in your composer:
"wbraganca/yii2-dynamicform": "2.0.2",
"kartik-v/yii2-widget-select2": "1.0.0"
Have some problem. Fix by add function to my script:
function initSelect2Loading(a,b){ initS2Loading(a,b); }
It seems to work..
Hi, anyone create an pull request? Seems a reasonable solution ;)
I solve this problem doing that. Create a js file named dynamicform.js and put on web/js folder. Add js file on the view that i use the modules.
registerJsFile(Yii::$app->getUrlManager()->getBaseUrl().'/js/dynamicform.js',['depends'=>[\yii\web\JqueryAsset::className()], 'position'=>View::POS_END]); ?>And inside the file dynamicform.js i write this:
function initSelect2Loading(a,b){ initS2Loading(a,b); } function initSelect2DropStyle(id, kvClose, ev){ initS2Open(id, kvClose, ev); }
So, when the module call initSelect2Loading and initSelectDropStyle that will run initS2Loading and initS2Open
I'm using this versions
"kartik-v/yii2-widget-select2": "@dev",
"wbraganca/yii2-dynamicform": "dev-master",
and in the dynamicform.js file I just replaced the init2Open function to initS2ToggleAll function, like @DanLivassan said.
function initSelect2Loading(a,b){ initS2Loading(a,b); }
function initSelect2DropStyle(id, kvClose, ev){ initS2ToggleAll(id, kvClose, ev); }
I don't know if this was usefull for someone, but I hope so.
This works for me, thank you. By the way, can someone pull request this solution?
@Lachos
This works for me too. Thanks
@dinzrus not working
Uncaught TypeError: Cannot read property 'settings' of undefined