wbraganca / yii2-dynamicform

It is widget to yii2 framework to clone form elements in a nested manner, maintaining accessibility.
Other
436 stars 438 forks source link

Doesn't work with Kartik Checkbox-X #56

Open cloudcaptain opened 9 years ago

cloudcaptain commented 9 years ago

The following code fixed this issue for me.

       // "kartik-v/yii2-checkbox-x"
        var $hasCheckboxX = $(this).find('[data-krajee-checkboxx]');
        if ($hasCheckboxX.length > 0) {
            $hasCheckboxX.each(function() {
                if ($(this).attr('class') == 'cbx-loading') {
                    var ckxOptions = eval($(this).attr('data-krajee-checkboxx'));
                    $(this).checkboxX(ckxOptions);
                }
            });
        }
user1007017 commented 7 years ago

in my case combined with select2-selection--multiple patch

  // identifiers[i] = $elem.closest(widgetsOptions[i].widgetItem).index();
                       //PATCH:
                       if(typeof widgetsOptions[i] !== 'undefined'){
                           identifiers[i] = $elem.closest(widgetsOptions[i].widgetItem).index();
                       }

this was working:

      // "kartik-v/yii2-checkbox-x"
        var $hasCheckboxX = $(widgetOptionsRoot.widgetItem).find("[data-krajee-checkboxx]");
        if ($hasCheckboxX.length > 0) {
            $hasCheckboxX.each(function () {
                if ($(this).attr("class") == "cbx-loading") {
                    var ckxOptions = eval($(this).attr("data-krajee-checkboxx"));
                    $(this).checkboxX(ckxOptions);
                }
            });
        }