Skip to content

Commit

Permalink
Added Restore of Kartik Datecontrol & datetimepick
Browse files Browse the repository at this point in the history
  • Loading branch information
Discomania committed Nov 3, 2022
1 parent bebb469 commit 498d3a3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/assets/yii2-dynamic-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,32 @@
initDepdropS2(id, loadingText);
}
});
}

// "kartik-v/yii2-widget-datecontrol"
var $hasDateControl = $(widgetOptionsRoot.widgetItem).find('[data-krajee-datecontrol]');
if ($hasDateControl.length > 0) {
$hasDateControl.each(function() {
var id = $(this).attr('id');
var dcElementOptions = eval($(this).attr('data-krajee-datecontrol'));
if (id.indexOf(dcElementOptions.idSave) < 0) {
// initialize the NEW DateControl element
var dcElementOptions = $.extend(true, {}, dcElementOptions);
dcElementOptions.idSave = $(this).parent().next().attr('id');
// $(this).removeAttr('value name data-krajee-datecontrol');
$(this).removeAttr('data-krajee-datecontrol');
}
$(this).datecontrol(dcElementOptions);
});
}

// "kartik-v/yii2-widget-datetimepicker"
var $hasDatetimepicker = $(widgetOptionsRoot.widgetItem).find('[data-krajee-datetimepicker]');
if ($hasDatetimepicker.length > 0) {
$hasDatetimepicker.each(function() {
$(this).datetimepicker('remove');
$(this).datetimepicker(eval($(this).attr('data-krajee-datetimepicker')));
});
}
};

Expand Down

0 comments on commit 498d3a3

Please sign in to comment.