Welcome Guest Search | Active Topics | Sign In | Register

Editable Calendar again - fill-in each day box by javascript looping & DayRender Options
Danny Chok
Posted: Monday, August 20, 2007 12:31:14 AM
Rank: Member
Groups: Member

Joined: 8/16/2007
Posts: 10
Hi again,

I am doing an e-Leave app by extending the "Editable Calendar" sample code and now I am adding a "multiple dates selector" function to select a range of dates for leave application.

Now I have trouble on the following script, and I have captured screens downloadable at
http://www.sendspace.com/file/8ffw2d


After user enters a "From Date" & "To Date" in the pop-up form (e-leave1.gif), it runs this javascript to loop through each day and trigger a CallBack (which triggers DayRender) for building the HTML in each day box. (e-leave2.gif, e-leave3.gif). However, without the alert() statement, the script always stops at the 12th day.. I have tried to add code to skip some days in between, and it also skips them and but still stops at the 12th one. (i.e. 1,2,3,4,5,6,9,10,11,12,13,14)

I don't know why if I add the alert statement (e-leave4.gif, e-leave5.gif, e-leave6.gif), it prompt alert for each day, but it can run till the end (=From Date 20/8).




var curDate = fromLeaveDate;

do {
user_input = eo_DateToString(curDate) + '^' + leave_type + '^BO^' + remarks;
eo_Callback('<%=CallbackPanel1.ClientID%>', user_input);

//alert(curDate + "||" + toLeaveDate);

curDate.setDate(curDate.getDate() + 1);
}
while (curDate <= toLeaveDate);
Danny Chok
Posted: Monday, August 20, 2007 12:45:59 AM
Rank: Member
Groups: Member

Joined: 8/16/2007
Posts: 10
The program flow is like this:

click on pop-up "Save" button

-> run the client-side javascript

-> run server-side "CallbackPanel1_Execute()"

-> run "GeneratePnlChanges()" to generate the confirmation panel below the Calendar if there is leave app

-> run "Calendar1_DayRender()" 31 times for each day

-> run server-side "CallbackPanel1_Execute()" again....


Please let me know if you need any more info. It seems like somehow the previous request is not done yet before the next call, and that's why an alert in between each day helps???

Many thanks. If I can't solve it, I will remark "max 12 days" for multiple day selection

OR otherwise, I will try to modify the code to call "eo_Callback()" just once.
eo_support
Posted: Monday, August 20, 2007 6:02:54 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi Danny,

You definitely do not want to run that many times of Callback in a loop. One Callback should be enough for you to update all the day cells because the whole Calendar control is rendered as a whole. So one Callback will call your DayRender 31 times.

Internally the Callback maintains a queue and when it gets full, it discards further calls. That's could be what causes it to stop at 12th.

Thanks
Danny Chok
Posted: Monday, August 20, 2007 5:37:14 PM
Rank: Member
Groups: Member

Joined: 8/16/2007
Posts: 10
thanks for your quick response.. I will try.. ^^


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.