How to set Calandar minDate max Date dynamicaly

Hi all.

In a datatable I have a element view: ‘calandar’ with editor: ‘date’. For this I use to set minDate generaly like:

webix.editors.$popup.date = {
        view:'popup',
        body:{
            view:'calendar',
            type:'date',
            borderless:true,
            minDate: new Date(),
        }
    };

Which start from today and disallow for setting date in the past. but sometimes I would like to cancle this limitation. I have this as example:

$$('protocols-table').getColumnConfig('process_date')

to get the column property… But I don’t know to setup minDate to null :frowning:

Please help

Michael

try to set editor’s options in onAfterEditStart event
https://snippet.webix.com/n6eh4mv4

Thank you so much, integral.

You saved my time… I had to change it a bit… in:

let editor = this.getEditor(cell);
let calendar = editor.getPopup().getBody();
calendar.config.minDate = null;
calendar.refresh();

cause minDate has already been defined. but good to know how to reach body object in popup editor :slight_smile:

I’m very happy…

Michael

while your method is not wrong, define method is more preferred.
you can use define('minDate', null) and it will set config.minDate = null.
but if component has inner setter like minDate_setter then this setter will be triggered.
p.s.: I have just checked define('minDate', null) and it does not clear but somehow always sets value to today.
not sure if it is by design or bug.
so probably setting config.minDate explicitly would be better.
https://snippet.webix.com/anqrap1r

Thats true.

I checked it with define… null but that didn’t work I think cause in

webix.editors.$popup.date = {
        view:'popup',
        body:{
            view:'calendar',
            type:'date',
            borderless:true,
            minDate: new Date(),
        }
    };

Which I had in the init script, it has been already defined! Maybe you can’t define twice.