Trick #4: Make Calendar Object Display Start on Sunday.

So here's the story, short n sweet:

Our Ajax-client Calendar Object used to display Sunday as first (left-most) day of week. For some unknown reason, it started displaying Monday. My client wants it back "the old way". I'm 99.9% certain I didn't do anything to cause this change in behavior.

A search of the QlikView community turns up plenty of people asking the same question, but no solutions. Some very smart QlikTech people tell me that it's always acted this way; it's an international standard; it's not configurable.

Well that's all fine and good, but I know I've seen it start on Sunday in the past and, unfortunately, so has my client.

So I go into engineer mode...

I open a QlikView document in my browser, put the browser into debug mode and isolate the HTML for the calendar object. Noticing that the class of the calendar object shares the same name as a jQuery date_picker, I research that class and discover that there is a setting which controls the first day; coincidentally enough it's called firstDay. If firstDay=0, calendar object starts on Sunday; if firstDay=1 the calendar object starts on Monday, etc.

My next step is to search my QlikView server for a script that contains "firstDay".  Lo and behold, QvAjax.js references "firstDay". I MADE A BACKUP COPY OF QvAjax.js and then edited it, setting firstDay to 0.

Drum-roll please.....

TA! DA!  The calendar object now starts on Sunday!

NOTE: THIS IS NOT A QLIKTECH-SANCTIONED MODIFICATION. THIS (NEARLY) QUALIFIES AS A HACK TO QvAjax.js. PROCEED AT YOUR OWN RISK. BY PROCEEDING YOU AGREE THAT I'M NOT RESPONSIBLE IF YOU SCREW UP YOUR SERVER, ESPECIALLY IF YOU DIDN'T MAKE A BACKUP COPY OF QvAjax.js, IT'S YOUR OWN FAULT!

Anyway there are several references to firstDay in QvAjax.js but there's one place that has "firstDay:1". I simply changed it to "firstDay:0" to get the desired result.



No comments:

Post a Comment