calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Tue Feb 15, 2005 7:28 pm Post subject: How to toggle the day between 3 different states when being clicked? |
|
|
It's easy. Taking the HelloWorld demo as example, all you need is to add the following to the fAfterSelected in plugins.js:
Code: | function fAfterSelected(y,m,d,e) {
var evt=fGetEvent(y,m,d);
if (evt==null)
fAddEvent(y,m,d,"select-am","","green",null,null,null,null,1);
else if (evt[7]==1)
fAddEvent(y,m,d,"select-pm","","blue",null,null,null,null,2);
else if (evt[7]==2)
fAddEvent(y,m,d,"select-wholeday","","gold",null,null,null,null,3);
else if (evt[7]==3)
fRemoveEvent(y,m,d);
// put your own code here to store the status of each selection
fRepaint();
} |
Then set the giMarkSelected option in the normal.js to 0, which disables the default background change for selected date (so that our change can be revealed).
Note that the above code only makes the calendar in your browser cycle through 3 different states, you'll still need to add your own code in between to record the change (e.g. in a hidden form field) so ast to submit to backend server later.
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|