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

not work with kratik v date picker #83

Open bright-coder opened 9 years ago

bright-coder commented 9 years ago

clone widget not working how can i fix it ?

jb-studio commented 9 years ago

Hi! Did you fix this issue?

bright-coder commented 9 years ago

No, I can't fix it.

atakajlo commented 8 years ago

Use solution from https://github.com/wbraganca/yii2-dynamicform/issues/10#issuecomment-122772376

Add lines below to your own script

$(".dynamicform_wrapper").on('afterInsert', function(e, item) {
    var datePickers = $(this).find('[data-krajee-kvdatepicker]');
    datePickers.each(function(index, el) {
        $(this).parent().removeData().kvDatepicker('remove');
        $(this).parent().kvDatepicker(eval($(this).attr('data-krajee-kvdatepicker')));
    });
});
bright-coder commented 8 years ago

Good job

Sent from my iPhone

On Mar 24, 2559 BE, at 3:30 PM, Dmitriy notifications@github.com wrote:

Use solution from #10 (comment)

Add lines below to your own script

$(".dynamicform_wrapper").on('afterInsert', function(e, item) { var datePickers = $(this).find('[data-krajee-kvdatepicker]'); datePickers.each(function(index, el) { $(this).parent().removeData().kvDatepicker('remove'); $(this).parent().kvDatepicker(eval($(this).attr('data-krajee-kvdatepicker'))); }); }); — You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub

gupondcaf commented 8 years ago

Where it fix? fix in form.php or yii2-dynamic-form.js ?

$(".dynamicform_wrapper").on('afterInsert', function(e, item) { var datePickers = $(this).find('[data-krajee-kvdatepicker]'); datePickers.each(function(index, el) { $(this).parent().removeData().kvDatepicker('remove'); $(this).parent().kvDatepicker(eval($(this).attr('data-krajee-kvdatepicker'))); }); });

and (index, el) it mean ? please. i not know

atakajlo commented 8 years ago

@gupondcaf If you don't know where to put this code, put it into your view file like below

$this->registerJs(<<<JS
    $(".dynamicform_wrapper").on('afterInsert', function(e, item) {
        var datePickers = $(this).find('[data-krajee-kvdatepicker]');
        datePickers.each(function(index, el) {
            $(this).parent().removeData().kvDatepicker('remove');
            $(this).parent().kvDatepicker(eval($(this).attr('data-krajee-kvdatepicker')));
        });
    });
JS
, \yii\web\View::POS_END);
gupondcaf commented 8 years ago

it works

thank you very mush sir @atakajlo

DiegoRodriguezTandil commented 6 years ago

this solution solves one of the errors but the particular configurations of the component are not cloned. Example, save forma date

nitinsonawane234 commented 5 years ago

@gupondcaf If you don't know where to put this code, put it into your view file like below

$this->registerJs(<<<JS
    $(".dynamicform_wrapper").on('afterInsert', function(e, item) {
        var datePickers = $(this).find('[data-krajee-kvdatepicker]');
        datePickers.each(function(index, el) {
            $(this).parent().removeData().kvDatepicker('remove');
            $(this).parent().kvDatepicker(eval($(this).attr('data-krajee-kvdatepicker')));
        });
    });
JS
, \yii\web\View::POS_END);

$(this).parent().removeData().kvDatepicker('remove'); is not working, gives an error: Uncaught TypeError: $.fn.datepicker.deprecated is not a function

if I comment this line then first datepicker shows 2 datepicker and rest all datepicker working fine.