Search code examples
cssbootstrap-datetimepickerjquery-ui-layout

datetimepicker showing behind south pane


I have problem showing the datetimepicker in jquery ui layout it will show behind the south pane.

see fiddle

<div class="ui-layout-center">Center
    <p><a href="http://layout.jquery-dev.com/demos.html">Go to the Demos page</a></p>
    <p>* Pane-resizing is disabled because ui.draggable.js is not linked</p>
    <p>* Pane-animation is disabled because ui.effects.js is not linked</p>
</div>
<div class="ui-layout-north">North</div>
<div class="ui-layout-south">
  <div class="container">
    <div class="row">
        <div class='col-sm-6'>
            <div class="form-group">
                <div class='input-group date' id='datetimepicker1'>
                    <input type='text' class="form-control" />
                    <span class="input-group-addon">
                        <span class="glyphicon glyphicon-calendar"></span>
                    </span>
                </div>
            </div>

Solution

  • I had a similar problem I solved it like this. On open, I set the position off the widget.

    var $parent = $("#wrapper");
    $parent.css("position", "relative");
    $element
    .datetimepicker({
    widgetParent: $parent
    }).on("dp.show", function () {
    var widget = $(".bootstrap-datetimepicker-widget");
    if (widget[0]) {
      widget.css({
        position: "fixed",
        "z-index": 99999999,
        top: $element[0].getBoundingClientRect().top - widget.height() - 10,
        left: $element[0].getBoundingClientRect().left,
        bottom: "auto",
        right: "auto"
      });
    }
    });      
    

    In my project, I use the body tag as wrapper. But in this version I use a wrapper at the end.

    <div id="wrapper"></div>