Materialize: Datepicker not fully visible in model

Created on 3 Dec 2016  路  4Comments  路  Source: Dogfalo/materialize

Description

When you define your form in a model, and add a datepicker in it, then your when you click on datepicker input, it is not visible fully.

Datepicker should appear in seperate model.

Repro Steps

  1. Define a form in modal and add datepicker in form.
  2. Open the modal and add then open the datepicker.

Screenshots / Codepen

image

Most helpful comment

@kirtangajjar
Duplicate to: https://github.com/Dogfalo/materialize/issues/1032
Solution: https://codepen.io/tomscholz/pen/oYEEqV
Make sure that you add container: 'body' to $('.datepicker').pickadate({. Then it will work properly

$('.datepicker').pickadate({
  container: 'body'
})

All 4 comments

@kirtangajjar
Duplicate to: https://github.com/Dogfalo/materialize/issues/1032
Solution: https://codepen.io/tomscholz/pen/oYEEqV
Make sure that you add container: 'body' to $('.datepicker').pickadate({. Then it will work properly

$('.datepicker').pickadate({
  container: 'body'
})

@tomscholz thanks :+1:

$('.datepicker').datepicker({
container: 'body'
})
Works in 2018!

Just put below code in jquery load function and change your proper id instead of txtSignatureDate

$('#txtSignatureDate').pickadate({
container: ".modal-body",
format: sdateformate,
selectMonths: true,
selectYears: 15,
onOpen: function () {
$('#txtSignatureDate_root .picker__holder').attr('style', 'height:' + $('#modalTraining .modal-content').innerHeight() + 'px');
//$("#txtSignatureDate_root .picker__frame").attr('style', 'top:' + ($('#modalTraining .modal-content').innerHeight() - 500) + 'px');
},
onSet: function (e) {
if (e.select) {
this.close();
$("#txtSignatureDate_root .picker__holder").removeAttr("style");
$("#txtSignatureDate_root .picker__frame").removeAttr("style");
} else {
$("#txtSignatureDate_root .picker__holder").removeAttr("style");
$("#txtSignatureDate_root .picker__frame").removeAttr("style");

                    }
                }, onClose: function () {
                    $("#txtSignatureDate_root .picker__holder").removeAttr("style");
                    $("#txtSignatureDate_root .picker__frame").removeAttr("style");
                },
            });

for css side add

.picker--opened .picker__frame {
top: 45%;
bottom: auto;
}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexknipfer picture alexknipfer  路  3Comments

ericlormul picture ericlormul  路  3Comments

artur99 picture artur99  路  3Comments

bradley-varol picture bradley-varol  路  3Comments

acierpinski picture acierpinski  路  3Comments