Hi,
I created an Flatpicker instance by
var fp = $("#date").flatpickr({
minDate: "today",
locale: {
firstDayOfWeek: 1
},
});
and after performing an ajax call, I get a set of dates which I need to color conditionally, so how to call onDayCreate in the ajax success callback method?
I tried
fp.set('onDayCreate', function (dObj, dStr, fp, dayElem) {});
fp.onDayCreate = function (dObj, dStr, fp, dayElem) {};
none of the above method worked as expected. Please guide on how to call onDayCreate after instantiating flatpickr.
Thank You!
Hello,
Perhaps its not working because hooks are collected into an array.
Try this:
// once your data is loaded, do this
fp.config.onDayCreate = [
function (dObj, dStr, fp, dayElem) { }
];
fp.redraw();
Most helpful comment
Hello,
Perhaps its not working because hooks are collected into an array.
Try this: