|
Rank: Newbie Groups: Member
Joined: 9/6/2012 Posts: 5
|
I recently purchased eo.web and I have been unable to find an answer to this question in the sample code, or by searching the forum. I'd like to have a link on the footer template of the calendar control to close the calendar popup and populate the datepicker textbox with the current date. This is a feature in the AJAX control that comes with .NET. Perhaps something like this, only with the appropriate method call(s)? Thanks! Quote: <FooterTemplate> <table border="0" cellpadding="0" cellspacing="5" style="font-size: 11px; font-family: Verdana"> <tr> <td width="30"> </td> <td valign="center"> <img src="{img:00040401}"></img> </td> <td valign="center"> <a class="eo_calendar_style1_title_button" href="javascript: void {var:this}.goTo(1);"> Today: {var:today:MM/dd/yyyy}</a> </td> </tr> </table> </FooterTemplate>
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
The code you posted is right, only you can't put void there. Is it not working for you?
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 9/6/2012 Posts: 5
|
Yes, it works - but it isn't the java call I want (it is only an example for implementing a link), my example code just changes the month forward one month. I don't want to use "goTo()".
When I click on the link, I want the datepicker to contain the current date, just as if I clicked on the current date in the calendar popup. What method call do I need to use and an example with the parameters would be greatly appreciated. If you have documentation on this, please provide a link.
Thanks, Dave
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi, I believe goTo is the right function to call: http://www.essentialobjects.com/doc/1/jsdoc.public.calendar.goto.aspxIn fact "officially" you should pass goTo a JavaScript Date object. Internally goTo does allow a JavaScript Number object but that is an undocumented feature. So if you want the Calendar goes to the current month, you just pass goTo a Date object that represents the current month (the day in the month and time portion does not matter and will be ignored). Thanks
|
|
Rank: Newbie Groups: Member
Joined: 9/6/2012 Posts: 5
|
Actually, the right function call may be setSelectedDate(new Date()). Thanks for the link, I hadn't noticed the Client API reference before, so I got part of the way to my goal. This selects the current date, which is what I want. However the calendar popup remains. I would like the popup to disappear as if I had clicked on one of the days on the calendar. So, I used eo_HideAllPopups() and this works for me, but I am wondering if there is a more elegant way to hide just the popup associated with this datepicker. Here is my code: Quote: <FooterTemplate> <table border="0" cellpadding="0" cellspacing="5" style="font-size: 11px; font-family: Verdana"> <tr> <td width="30"> </td> <td valign="center"> <img src="{img:00040401}"></img> </td> <td valign="center"> <a class="eo_calendar_style1_title_button" href="javascript: void {var:this}.setSelectedDate(new Date());eo_HideAllPopups();"> Today: {var:today:MM/dd/yyyy}</a> </td> </tr> </table> </FooterTemplate> Thanks for your help, Dave
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
What you come up is probably the best way to do that. By default, the Calendar automatically closes the popup for mouse down event in the drop down ---- except for in the header and footer area, where the mousedown/up event is being canceled so that you will be able to receive click event if you wish so (otherwise you will never be able to get click event because there would never be a mouse up event). This logic is hardcoded so there is no way to change it. That leaves the only option as "manually" closing the popup with eo_HideAllPopups.
The only problem with this solution is if you have nesting popups. For example, if you have a drop down menu, then have a DatePicker drop down inside the menu drop down, in that case eo_HideAllPopups will close both the menu and the DatePicker drop down. In order to avoid that problem, we will have to add a method on the DatePicker to allow you only close the DatePicker popup. Unfortunately that does not exist yet. We will see if we can add it in our next build.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 9/6/2012 Posts: 5
|
Thanks for the update, I appreciate it!
Dave
|
|