Set invalid dates using remote/dynamic data

Hello,

I’m using remote data through an external request, using the setEvents method to set the events.

But, I need also to set the invalid dates dynamically or using alson remote data. How can I achieve this?

Thanks

Hi there,

You can use the setOptions method for that:

myInstance.setOptions({
    invalid: [...]
});

Thanks Gabi, but I mean, dynamically, querying a database, as I set events per user basis like this:

mobiscroll.util.http.getJson(’/data/calendario.php?user_id=’+id, function (events) {
calendar.setEvents(events.cal);
}, ‘json’);

And each user has it’s own invalid dates.

Hi Chorch, this usage is applicable inside the json request as well.

Thanks, but, how?

I couln’t find any info in the docs about how to format the json or set the invalid dates received…

Hi @Chorch

Can you provide some more details on what are you having trouble with exactly?
To set the invalids to the eventcalendar you have to call the setOptions method the same way you call the setEvents:

calendar.setEvents(events.cal);
calendar.setOptions({
  invalid: myInvalids
});

In the above example myInvalids has to be the array of the invalids.