search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

A custom modal popup form closes periodically - how can this be overcome with other DayPilot controls?

Asked by mrplatypus (aka Dave)
8 years ago.

Hi Dan and Team,

I'm trying to get a button to display a modal form so that the user can perform other tasks to the application while keeping the main form populated underneath.

My issue is that also on the same page there are other DayPilot controls:
DayPilotScheduler; DayPilotMenu; DayPilotNavigator

The modal form displays but does not stay open, obviously to a screen refresh in one of the controls.

The DayPilotScheduler control, I know, makes use of a modal dialog box in order to perform other processes and that does not "timeout" and disappear from the screen.

Please advise on how I can implement this with the controls at my disposal?

Thanks

mrplatypus (aka Dave)

Comment posted by Dan Letecky [DayPilot]
8 years ago.

Dave, when does the modal get hidden:

1. Is it immediately after display?
2. Automatically, after some time?
3. After a specific user action?

By default it gets hidden if you call modal.close() or if you click the background div that covers the whole screen (beneath the modal).

Comment posted by mrplatypus (aka Dave)
8 years ago.

After a small period of time, the daypilot.modal dialog box displays, with the intended content;
then on an automatic refresh, it gets hidden.

Comment posted by Dan Letecky [DayPilot]
8 years ago.

How do you invoke the refresh - do you use the AutoRefresh feature of the Scheduler? Or do you reload the whole page?

Comment posted by mrplatypus (aka Dave)
8 years ago.

It would be the autorefresh feature of the scheduler that is being used..

Comment posted by Dan Letecky [DayPilot]
8 years ago.

The AutoRefresh shouldn't affect the modal dialog.

I've tried to reproduce the issue using the following demo:
http://www.daypilot.org/demo/Scheduler/AutoRefresh.aspx

It refreshes the events every 10 seconds. Clicking an event opens the modal dialog. In my tests it stays open even if after the refresh.

Just a few things to explore:

1. Does the page fully reloads? You'd see a full page GET request in the Network tab of developer tools in this case. That would redraw the whole page and the modal dialog would get hidden in that case.

2. Do you use AfterRenderJavaScript? Maybe there is something in that event handler that either refreshes the page or closes the dialog.

3. Anything suspicious in the browser console (JavaScript error, etc.)?

Comment posted by mrplatypus (aka Dave)
8 years ago.

Dan,

1) As far as I can see, yes the page fully reloads
2) Yes the "AfterRenderJavaScript" property of the daypilotscheduler is in use.
3) No, I cannot see anything suspicious

Dave

Comment posted by Dan Letecky [DayPilot]
8 years ago.

Is the page reloaded using a POST or GET request?

DayPilot normally doesn't refresh the page - the only exception is a PostBack but that always requires a user action.
The AutoRefresh only uses a CallBack.

Comment posted by mr platypus
8 years ago.

Dan,

Its not a full postback page..
Neither am I using UpdatePanels to do a partial postback..

Presumably then it is a callback call which is hiding the daypilot.modal form.

All I have done is:

1) add a new linkbutton control to the page
2) configured the onclientclick event of the linkbutton to call some javascript
3) the javascript then makes use of the daypilot.modal control to view the target page..

Is this the correct approach I should be using or is there another way?

Please advise.

Thanks

Dave

Answer posted by Dan Letecky [DayPilot]
8 years ago.

Dave,

It looks like the LinkButton might reload the page. Adding the OnClientClick event handler doesn't prevent the default action (PostBack). Can you try adding "return false;" to the event handler, like this?

.... OnClientClick="openModal(); return false;" ...

Comment posted by mr platypus
8 years ago.

Dan,

Looks like that has fixed the problem..

Thank you.

mrplatypus ;) (aka Dave)

Comment posted by Dan Letecky [DayPilot]
8 years ago.

Great, thanks for the update!

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.