|
Rank: Newbie Groups: Member
Joined: 12/29/2010 Posts: 7
|
On date selection (server-side) calendar should invoke popup function (client side) to show some loading animation. I have tried: DatePicker1.Attributes.Add("ClientSideOnSelect", "displayLoader('imgLoaderId');"); but it doesn't work
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, ClientSideOnSelect takes a function name, not a function call. The arguments to the function are predefined. This is similar to .NET server side event handler. You write the handler but you do not define the arguments. This topic explains the predefined arguments for this event: http://doc.essentialobjects.com/library/1/jsdoc.public.handlers.calendar_event_handler.aspxThanks!
|
|
Rank: Newbie Groups: Member
Joined: 12/29/2010 Posts: 7
|
I need this to show an ajax progress animation in browser while business logic behind DateChange event is performed on server side and client is waiting for result. The sequence is following: 1. User changes date 2. Javascript shows animation 3. Some server code runs 4. Results are displayed 5. Animation is hidden
Could you please provide sample how to perform call of javascript function, e.g. displayLoader("SomeKnownArgument") on date selection/change?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, It will be something like this:
Code: JavaScript
function your_select_handler(calendar, eventName)
{
//call whatever code you want to call here
.....
}
Code: HTML/ASPX
<eo:Calendar ClientSideOnSelect="your_select_handler" .....>
....
</eo:Calendar>
If you have not used our client side API before, you can take a look of this topic: http://doc.essentialobjects.com/library/1/clientapi_howto.aspxNote that ClientSideOnSelect takes the function name that you would implement (you can change "your_select_handler" to anything as long as it matches your real function). When user selects a date, your function will be called. You can then perform whatever you need to perform inside that function. We do not provide any support beyond our product or offer solution/implementation advice on a specific business scenario or user requirement. So how to display animation or trigger server side code is beyond the scope of the support here. From the Calendar points of view, it calls your function when user selects a Date and that's where it ends. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 12/29/2010 Posts: 7
|
ClientSideOnSelect="some_handler" is working perfect when using only client side. But when I add AutoPostbackOnSelect="true" to DatePicker - it stops working. How can I use both AutoPostBack with ClientSideOnSelect?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
I see what you meant. That behavior is by design. Once you set to AutoPostBackOnSelect, the Calendar will not call your ClientSideOnSelect because the whole page is about to be posted back. Once the page posts back, the current page is completely discarded and a new page is reloaded (even though the Urls for both pages are the same). That means even if it were to call your ClientSideOnSelect handler, whatever you intended to do inside that handler may not work at all. For example, if you plan to play an animation, then the animation will immediately stop because the page is reloaded.
If you wish to handle ClientSideOnSelect and post back the page at the same time, you can set AutoPostBackOnSelect to false, but then raises post back in your handler by yourself. That way you can have full control of when and how to raise the post back. For example, you may want to wait until your animation is done and then raise the post back.
Thanks!
|
|