Declined
Last Updated: 13 Sep 2023 10:57 by ADMIN
Alan
Created on: 05 Sep 2023 10:18
Category: UI for Blazor
Type: Feature Request
2
Window with PersistContent="true" should remain in DOM when not visible

Hi,

I'm in the process of implementing a form in a Window component and would like the content to remain present in the DOM between hiding and showing of the window. I noticed that there's a line in the documentation where it states that PersistContent will allow the content of the window to remain in the DOM whenever the window is minimized. I recommend this be extended to the Visibility of the form, not just minimizing, as to create a more coherent approach.

I did come across this post here where it gives a description of how the above is achieved. This is a very inelegant approach as the consumer of the framework has to manually implement stuff which should be provided by the framework. The suggested approach also prevents the developer from opening multiple windows at once, which might be an issue in some cases.

3 comments
ADMIN
Dimo
Posted on: 13 Sep 2023 10:57

Hello Alan,

Thanks for the additional information.

We discussed the case in our team and I have to confirm that we won't be adding the discussed behavior.

On one hand, it's indeed trivial to implement. On the other hand, it creates several concerns related to:

  • Fundamental component behavior - our components follow the pattern that when something is not Visible, it's not rendered;
  • Possible breaking change for everyone who is already using PersistContent="true";

I agree that it is beneficial to perform resource-intensive data requests just once. I hope it's feasible to move the data requests one level up in the component hierarchy, so that the code outside the Window. Then, pass the data to the component inside the Window.

Regards,
Dimo
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
Alan
Posted on: 11 Sep 2023 14:17

Hi Dimo,

 

Thanks for the sample, appreciate the time and effort put into it. The example you provided works great as all of the data is loaded in the model and there is no further interactions with the components. Let me give you some context which might highlight the problem I have. Added a REPL link for assistance.

https://blazorrepl.telerik.com/wHatlllo00Ba3lXw33

Basically the idea is this. We have a window with multiple controls in it, most of which containing MultiSelects. Each of these components is responsible for getting its own data, in order to promote re-usabililty. Populating numerous MultiSelect components from a database can be quite expensive, so such data is ideally loaded on screen load whilst the window is hidden and persisted throughout the lifetime of the page. As is, the current implementation would result in the data reloaded each and every time the window is hidden and shown again.

When it comes to presentation, we are after a window being shown as a modal, so with a backdrop blocking anything behind the window when the window is visible, and completely hidden when not visible, allowing the user to resume working on whatever was in the background. Minimzing the window when set to modal will still leave backdrop and the window's titlebar visible when minimized, resulting in both approaches not fitting our case. Hence the recommendation that PersistContent should behave the same for window minimzed and hidden.

 

 

ADMIN
Dimo
Posted on: 11 Sep 2023 13:08

Hello Alan,

A Form inside a Window doesn't require a special feature to persist its content, because the underlying model is normally updated on the fly. Here is an example: https://blazorrepl.telerik.com/GROXvPFn06Bis3NL29

Can you please describe your scenario in more detail and what specific problem are you trying to solve? Also, why minimizing the Window is not an option if the content is to be reused afterwards?

Regards,
Dimo
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!