Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Materialize datepicker SelectOnClose not working

I'm trying to create a datepicker with Materialize. According to the documentation the datepicker should close when the user selects a date.

That's not working in my page. I'm using the latest Chrome browser on Windows. I've tried IE browser, but there's the whole datepicker not showing...

Click here for my page (input 3 and 4 are datepickers)

My javascript:

$('#due_date').pickadate({
  monthsFull: [ 'januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december' ],
  monthsShort: [ 'jan', 'feb', 'maa', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec' ],
  weekdaysFull: [ 'zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag' ],
  weekdaysShort: [ 'zo', 'ma', 'di', 'wo', 'do', 'vr', 'za' ],
  today: 'vandaag',
  clear: 'verwijderen',
  close: 'sluiten',
  firstDay: 1,
  format: 'dd-mm-yyyy',
  formatSubmit: 'yyyy/mm/dd',
  closeOnSelect: true,
  selectMonths: true, // Creates a dropdown to control month
  selectYears: 3, // Creates a dropdown of 15 years to control year
  min: new Date()
});

Can anyone help me to fix these datepickers?

like image 484
Ilona Avatar asked Apr 05 '15 21:04

Ilona


1 Answers

Please add below few lines to your code..

onSet: function (ele) {
   if(ele.select){
          this.close();
   }
}
like image 114
Kenath Avatar answered Oct 09 '22 10:10

Kenath