yii2-dynamicform icon indicating copy to clipboard operation
yii2-dynamicform copied to clipboard

not work with kratik v date picker

Open bright-coder opened this issue 9 years ago • 9 comments

clone widget not working how can i fix it ?

bright-coder avatar Sep 05 '15 09:09 bright-coder

Hi! Did you fix this issue?

jb-studio avatar Sep 30 '15 08:09 jb-studio

No, I can't fix it.

bright-coder avatar Sep 30 '15 12:09 bright-coder

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')));
    });
});

atakajlo avatar Mar 24 '16 08:03 atakajlo

Good job

Sent from my iPhone

On Mar 24, 2559 BE, at 3:30 PM, Dmitriy [email protected] 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

bright-coder avatar Mar 24 '16 10:03 bright-coder

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

gupondcaf avatar Mar 30 '16 09:03 gupondcaf

@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);

atakajlo avatar Mar 30 '16 17:03 atakajlo

it works

thank you very mush sir @atakajlo

gupondcaf avatar Mar 31 '16 01:03 gupondcaf

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

DiegoRodriguezTandil avatar Feb 05 '18 13:02 DiegoRodriguezTandil

@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.

nitinsonawane234 avatar Feb 25 '19 13:02 nitinsonawane234