Closed M-Fares closed 8 years ago
Mind checking the resulting javascript?
You should add datepicker manually for dynamically genereted instances:
function multipleDatepickers()
{
$(".dynamicform_wrapper").on("afterInsert afterDelete", function(e, item) {
var VarItemsQuantity = $('.item').length,
VarCounter = 1;
for(VarCounter; VarCounter < VarItemsQuantity; VarCounter++) {
$('#WorkExperiencesModel-' + VarCounter + '-StartDate').
parent().datepicker({"autoclose":true, "format":"dd-M-yyyy", 'language':'ru',});
$('#WorkExperiencesModel-' + VarCounter + '-EndDate').
parent().datepicker({"autoclose":true, "format":"dd-M-yyyy", 'language':'ru',});
};
});
}
@Flashwade1990 Solution works fine!
Donde agrego la funcion?? unction multipleDatepickers() { $(".dynamicform_wrapper").on("afterInsert afterDelete", function(e, item) { var VarItemsQuantity = $('.item').length, VarCounter = 1; for(VarCounter; VarCounter < VarItemsQuantity; VarCounter++) { $('#WorkExperiencesModel-' + VarCounter + '-StartDate'). parent().datepicker({"autoclose":true, "format":"dd-M-yyyy", 'language':'ru',}); $('#WorkExperiencesModel-' + VarCounter + '-EndDate'). parent().datepicker({"autoclose":true, "format":"dd-M-yyyy", 'language':'ru',}); }; }); }
@jhonnyfcr use $this->registerJs
and only:
$(".dynamicform_wrapper").on("afterInsert afterDelete", function(e, item) {
var VarItemsQuantity = $('.item').length,
VarCounter = 1;
for(VarCounter; VarCounter < VarItemsQuantity; VarCounter++) {
$('#WorkExperiencesModel-' + VarCounter + '-StartDate').
parent().datepicker({"autoclose":true, "format":"dd-M-yyyy", 'language':'ru',});
$('#WorkExperiencesModel-' + VarCounter + '-EndDate').
parent().datepicker({"autoclose":true, "format":"dd-M-yyyy", 'language':'ru',});
};
});
I don't know if should post this here or on dynamic form but I am posting anyway
I implemented it like this, the datepicker popup appears only for the first Item and not for the other dynamic items
خبرات العمل
خبرات العمل