I have created a jQuery datepicker that has some days coloured (weekends, holidays). The fact is that the decission to colour that days depend on a ajax call that returns which days of the month have to be coloured.
When I click to the button to change the month, the ajax call is done, it returns the days to be coloured, the dateplicker flickers and then it displays the month correctly. I would like to display the new month once the ajax call is done and not earlier. Is there any way to avoid the flicker? It seems to work correctly in Internet explorer, but it doesnt work in Firefox.
EDIT
If you click in change month button, the datepicker calls beforeShowDay for each day in the month to render it. If you put a breakpoint in console.log line (the jsfiddle example is below), you will see that the datepicker is closed and that it isn't rendered until every day is drawed. In my case, I want to maintain the old month until the the new month is fully drawed.
In the example that you can se below, the drawing of the calendar is really fast, and the days of the month are rendered so quickly that it seems to be instant, but if you do some ajax calls that retrieve database data to decide the colour that will have each day, the month flickers. Unlike Internet explorer, that problem happens to me in Firefox.
How can I fix it?
Fiddle example:
http://jsfiddle.net/b6V3W/370/
beforeShowDay: tratarDiasEspeciales,
function tratarDiasEspeciales(date){
ajax call to decide the colour of the cell
if(condition){
//colour the day with blue
return[true,'blue']
}else{
//colour the day with red
return[true,'red']
}
}