Jack_Walter
Posts: 39
|
| Posted: 09/14/2008, 5:41 AM |
|
Hi,
The default JS date picker should not be replaced. But one thing is bothering me...
The table width changes depending on the length of the month.
So it is relatively small if you have a short month like "may" and larger if "september" is displayed. That makes it very difficult to stay with the mouse on one position if you just want to flip e.g. months because this backward / forward button varies it's position also...
Is there a way to fix this width so that it always stays at the same size (ignoring month text length changes)?
Regards,
Jack
|
 |
 |
datadoit
|
| Posted: 09/14/2008, 9:25 AM |
|
Well, if you're feeling brave you could go into the DatePicker
javascript file (DatePicker.js), find this string:
listMonths[DatePickerObject.currentMonth]
and replace with:
listShortMonths[DatePickerObject.currentMonth]
All of your date pickers will then display the short month instead of
full text.
|
|
|
 |
Jack_Walter
Posts: 39
|
| Posted: 09/14/2008, 11:15 AM |
|
Great,
now it's a lot more useable than before 
Thanks for your help datadoit!
Regards,
Jack
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 09/14/2008, 3:03 PM |
|
DD, you beat me to it.

I had a div inserted and was experimenting with the width='nn px'
Then the topic changed to resolved.
Good workaround.
If you are so handy with this js stuff how about:
"<LABEL ID=\"labelMonth\" >"+listMonths[DatePickerObject.currentMonth]+"
calculate the length of listMonths[DatePickerObject.currentMonth]
substract that from the length of the largest in that array and add the result in nbsp's
All in one small trick of course 
You'd be my hero!
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 09/14/2008, 3:46 PM |
|
Stubborn as I am (known for) I do not withold you my solution:
This being the original content of datepicker.js
Search for "function buildTop()"
// Create the top DatePicker part
function buildTop()
{
// Create the top part of the DatePicker
var imgPrevYear = DatePickerObject.themePath+"PrevYear.gif";
var imgPrevMonth = DatePickerObject.themePath+"PrevMonth.gif";
var imgNextMonth = DatePickerObject.themePath+"NextMonth.gif";
var imgNextYear = DatePickerObject.themePath+"NextYear.gif";
if (DatePickerObject.themeVersion=="3.0")
{
imgPrevYear = DatePickerObject.themePath+"Images/Back.gif";
imgPrevMonth = DatePickerObject.themePath+"Images/Prev.gif";
imgNextMonth = DatePickerObject.themePath+"Images/Next.gif";
imgNextYear = DatePickerObject.themePath+"Images/Forward.gif";
}
We are only interested in this part of the function:
var datepickerDocument = (DatePickerObject.themeVersion=="3.0"?"":"<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 CLASS=CalendarControls>");
if (DatePickerObject.themeVersion!="3.0") datepickerDocument += "<TR><TD>";
datepickerDocument +=
"<A " +
"HREF=\"javascript:parent.opener.setPreviousYear()\"><IMG SRC=\""+imgPrevYear+"\" BORDER=\"0\"></A><A " +
"HREF=\"javascript:parent.opener.setPreviousMonth()\"><IMG SRC=\""+imgPrevMonth+"\" BORDER=\"0\"></A>";
if (DatePickerObject.themeVersion!="3.0") datepickerDocument += "</TD><TD ALIGN=\"center\" WIDTH=\"100%\">";
else datepickerDocument += " ";
datepickerDocument +=
"<LABEL ID=\"labelMonth\">"+listMonths[DatePickerObject.currentMonth]+"</LABEL> <LABEL ID=\"labelYear\">"+DatePickerObject.currentYear+"</LABEL>";
if (DatePickerObject.themeVersion!="3.0") datepickerDocument += "</TD><TD>";
else datepickerDocument += " ";
datepickerDocument +=
"<A " +
"HREF=\"javascript:parent.opener.setNextMonth()\"><IMG SRC=\""+imgNextMonth+"\" BORDER=\"0\"></A><A " +
"HREF=\"javascript:parent.opener.setNextYear()\"><IMG SRC=\""+imgNextYear+"\" BORDER=\"0\"></A>";
if (DatePickerObject.themeVersion!="3.0") datepickerDocument += "</TD></TR></TABLE>";
//prompt("",datepickerDocument)
return datepickerDocument;
}
As you might notice there are some test for themeVersion we turn them all around, meaning:
!="3.0" we change into =="3.0"
=="3.0" we change into !="3.0" (not the one's we just changed, silly)
the only other change is
WIDTH=\"100%\"
to be changed to
WIDTH=\"100px\"
resulting in this:
var datepickerDocument = (DatePickerObject.themeVersion!="3.0"?"":"<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 CLASS=CalendarControls>");
if (DatePickerObject.themeVersion=="3.0") datepickerDocument += "<TR><TD>";
datepickerDocument +=
"<A " +
"HREF=\"javascript:parent.opener.setPreviousYear()\"><IMG SRC=\""+imgPrevYear+"\" BORDER=\"0\"></A><A " +
"HREF=\"javascript:parent.opener.setPreviousMonth()\"><IMG SRC=\""+imgPrevMonth+"\" BORDER=\"0\"></A>";
if (DatePickerObject.themeVersion=="3.0") datepickerDocument += "</TD><TD ALIGN=\"center\" WIDTH=\"100px\">";
else datepickerDocument += " ";
datepickerDocument +=
"<LABEL ID=\"labelMonth\">"+listMonths[DatePickerObject.currentMonth]+"</LABEL> <LABEL ID=\"labelYear\">"+DatePickerObject.currentYear+"</LABEL>";
if (DatePickerObject.themeVersion=="3.0") datepickerDocument += "</TD><TD>";
else datepickerDocument += " ";
datepickerDocument +=
"<A " +
"HREF=\"javascript:parent.opener.setNextMonth()\"><IMG SRC=\""+imgNextMonth+"\" BORDER=\"0\"></A><A " +
"HREF=\"javascript:parent.opener.setNextYear()\"><IMG SRC=\""+imgNextYear+"\" BORDER=\"0\"></A>";
if (DatePickerObject.themeVersion=="3.0") datepickerDocument += "</TD></TR></TABLE>";
//prompt("",datepickerDocument)
return datepickerDocument;
}
Delivers a nice static monthname (full)
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
Jack_Walter
Posts: 39
|
| Posted: 09/14/2008, 4:22 PM |
|
Quote :Delivers a nice static monthname (full)
Here was a lot, really a lot of code *snipped*
Testing... Finshed... Works like a charm 
You should add Javascript to your signature Walter 
May I steel your precious time tomorrow, Walter?
I have a few complicated (ok, it's more: complicated for me, not for you) things here. But the good news are, these will probably the last ones for quite a while... I'd pm you with more details if that's ok for you...
Regards,
Jack
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 09/14/2008, 4:36 PM |
|
You're welcome jack.
Feel free to steal, will be at the wheel by 11 both our local time.
Am still playing with the date thingy, I have my own routine to do that but trying to fit it in to CCS regime.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
|