Open bright-coder opened 9 years ago
Hi! Did you fix this issue?
No, I can't fix it.
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')));
});
});
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
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 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);
it works
thank you very mush sir @atakajlo
this solution solves one of the errors but the particular configurations of the component are not cloned. Example, save forma date
@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.
clone widget not working how can i fix it ?