I actually had the same problem, and in the end I came up with this solution. Seems to work well. The main idea here is to connect to the show dicketimepicker ( dp.show ) event, separate it from where it is, and attach it to the body with position = absolute and set its location just below the target element.
Please note that the code below is taken from the directive that wraps bootstrap datetimepicker, however the same solution should be applied anywhere, as long as you can get the handle of the picker element.
Hope this helps someone :)
function link ($scope, $element, $attrs, ngModelCtrl) { //////////////////////////////////////////////////////////////////////////////// // the following code handles positioning of the datetimepicker widget // just below the target element. This is to avoid the hideous datepicker bug // that causes it to be trimmed when its parent has limited height // ZP //////////////////////////////////////////////////////////////////////////////// $element.on('dp.show', function(e) { // get the datetimepciker var elem = angular.element('.bootstrap-datetimepicker-widget'); // detach from parent element and append to body angular.element('body').append(elem); // get target element var target = e.currentTarget || e.delegateTarget || e.target; // get bounding rects of parent and element var targetRect = angular.element(target)[0].getBoundingClientRect(); var elemRect = elem[0].getBoundingClientRect(); // do some math var marginTop = 10; var center = targetRect.left + (targetRect.width / 2) - (elemRect.width / 2); var top = targetRect.bottom + marginTop; // position the widget properly just below parent elem.css('position', 'absolute'); elem.css('z-index', '10000000000000'); elem.css('top', top + 'px'); elem.css('bottom', 'auto'); elem.css('left', center + 'px'); }); }
Zacky pickholz
source share