max & min values for datepicker

Can i set a max and min value to a datepicker ?
ex: you can only select from (05/01/2015) to (05/30/2015).
the rest should be grayed out or not clickable

i tried this but it is not working
var calPopup = $$(“Datepicker1”).getPopup();
calPopup.define(“minDate”, w1_full_start_date);
calPopup.define(“maxDate”, w1_full_end_date);
calPopup.refresh();

The thing is that by calling $$("Datepicker1").getPopup(); you get a popup inside which the needed calendar lies. So your code will work if you get the calendar as $$("Datepicker1").getPopup().getBody();

Alternatively, you can specify these settings right in the datepicker configuration:

webix.ui({
   view:"datepicker", suggest:{
       view:"suggest", type:"calendar", body:{
          view:"calendar",
          height:260,
          icons:true,
          maxDate:"2015-05-20",
          minDate:"2015-05-01"
    }}  
});

http://webix.com/snippet/070c9893

1 Like