This is a migrated thread and some comments may be shown as answers.

Popup Lifecycle

3 Answers 51 Views
Popup
This is a migrated thread and some comments may be shown as answers.
Rafael
Top achievements
Rank 1
Rafael asked on 12 Jun 2020, 01:46 PM
I've noticed that when creating a popup directly from code, you don't need to set PlacementTarget. Somehow the code internally solve this and use the entire window as placement.

I'm wondering if I can instantiate several new dialogs on demand or do I have to reuse the same instance everytime? Example: displaying alerts everytime I need.

My concerns are about the lifecycle, whether the garbage collector destroy them after closing or the instances keep living forever inside the page or somewhere.

3 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 15 Jun 2020, 09:49 AM

Hi Rafael,

First, regarding PlacementTarget - as you already figured out, if PlacementTarget is not set explicitly, the popup takes by default the current page/view. 

As to your question about the memory - when the popup is closed,  it is taken out of the visual tree and at some point, the view that was displayed through the popup will be collected by the garbage collector. 

I am not sure I fully understand the concern here - you can use the same instance of the popup without a problem.

If you still have any concerns about this, can you elaborate more on the exact scenario - how the popup content is created, what approaches for the alerts have you considered? Some code snippets will be of great help as well.

Regards,
Yana
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Rafael
Top achievements
Rank 1
answered on 15 Jun 2020, 06:50 PM
Hi Yana,

Thanks for the reply. No more concerns.

For clarification: we are considering to use RadPopup as base for alerts, confirmations, prompts, etc (layout reasons), probably through a DialogService.

There might be cases of opening a popup on top of another (perhaps displaying something that can be deleted and must confirm). In these cases, more than one instance would be required.

That's why I asked if there are any consequences for not reusing / managing the instances ("zombies" inside PlacementTarget).

However, there is another better way to resolve this: having an instance for each type of dialog, as it's highly illogical to open alert over alert, confirmation over confirmation, etc.

Thanks,
Rafael
0
Yana
Telerik team
answered on 16 Jun 2020, 10:19 AM

Hi Rafael,

Thank you for the follow-up.

One thing to have in mind when using RadPopup  -  there is a limitation regarding opening popup from a popup on Android that comes from the native PopupWindow. In short, if you'd like to open more than one popups at the same time,  make sure they have the same parent (the page) -  the popup cannot have another popup as a parent.

I remain at your disposal if you have any additional questions on RadPopup.

Regards,
Yana
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Popup
Asked by
Rafael
Top achievements
Rank 1
Answers by
Yana
Telerik team
Rafael
Top achievements
Rank 1
Share this question
or