Search code examples
javascriptdatedatepickercalendarwebix

How to change maxDate in datepicker?


I'm trying to modify max/minDate in Webix datepicker. Inside the datepicker is a calendar where these properties are available. But AFAICS refresh() doesn't affect to the initially rendered config. How to overcome this?

demo: http://webix.com/snippet/d4ced99c

/* config */
 {
   view:"datepicker",
   id: 'endDate',
   suggest:{
     type:"calendar",
     id: 'endDateCl',
     body:{
       minDate:"2016-10-2",
       maxDate:'2016-10-21'
     }
   }
 }

/* then */    
$$("endDateCl").config.body.maxDate = "2016-03-31";
$$('endDate').refresh();

Solution

  • The refresh works, but you are setting the maxDate wrong, because maxDate is a ui:calendar property only. You should use the following to get the inner callendar:

    $$("endDate").getPopup().getBody().config.maxDate = new Date("2016-10-05");
    $$('endDate').refresh();