I apologize if this is a duplicate post, I did some searching and although there are some other related posts I could not find one exactly matching my issue that had a solution that worked. I am creating RadWindows dynamically via javascript (no server code involved) and have set my radwindowmanager initializebehavior to 'maximize' so when the window opens up it is maximized. I also allow the user to minimize and resize. When I resize the window and move the window around the screen, then minimize, then restore, the window returns to the position and size I last had it as I expected. However, if I open the window maximized, then minimize it, then restore, the window will not restore maximized. It comes up a smaller size and centered on the page. It doesn't seem to remember that it was maximized. Is there anything I can do to correct this issue? I found I can use the onclientcommand to always maximize on restore, but I would rather the window return to the initial size and position it was before it was minimized.
Thank you!
Richard
5 Answers, 1 is accepted
We are considering to change this behavior i.e. when you restore a minimized RadWindow that was maximized before, it will be restored maximized, but this would happen in a future release. For now I would suggest to use the solution that you found with OnClientCommand, but to add another step in the logic.
My idea is to raise a flag (global variable / value in a hidden field), when a RadWindow is maximized. Then when you restore the RadWindow you can check the flag and if it exists, (i.e. the window was previously maximized), to manually call maximize() again.
I hope this helps.
Greetings,
Georgi Tunev
the Telerik team
I saw this issue and it was mentioned to use OnClientCommand to automatically maximize a page each time it is restored but I could not find code to help figure this out. After spending quite a bit of time on it myself, I finally came across a solution for those that are opening the window from the client side and then need to manipulate it to avoid the restore state and automatically go between minimized and maximized. I've pasted code below and hope if helps others.
function OpenWindow(URL) {
params = '';
var wnd = window.radopen(URL, 'RadWindow1', params);
wnd.set_title('Test Window');
wnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Maximize + Telerik.Web.UI.WindowBehaviors.Minimize + Telerik.Web.UI.WindowBehaviors.Close);
wnd.set_visibleStatusbar(false);
wnd.set_skin('Web20');
wnd.set_keepInScreenBounds(true);
wnd.moveTo(0, 0);
wnd.maximize();
wnd.add_command(OnClientCommand);
return true;
}
function OnClientCommand(sender, eventArgs) {
var commandName = eventArgs.get_commandName();
if (commandName == 'Restore') {
//Cancel the restore event and call maximize instead to always maximize the window.
eventArgs.set_cancel(true);
sender.Maximize();
}
}
"We are considering to change this behavior i.e. when you restore a minimized RadWindow that was maximized before, it will be restored maximized"
Thanks
This has not been requested by our clients since and thus the behavior has not been changed. You can still use a few lines of JavaScript to get it, as shown in the previous post and as suggested by my colleague Georgi - by using a certain field to hold a flag, for example:
function
OnClientCommand(sender, eventArgs)
{
var
commandName = eventArgs.get_commandName();
if
(commandName ==
'Minimize'
)
{
sender.wasMaximized = sender.isMaximized();
}
if
(commandName ==
'Restore'
)
{
if
(sender.wasMaximized)
{
setTimeout(
function
()
{
sender.maximize();
sender.wasMaximized =
false
;
}, 0);
}
}
}
Regards,
Marin Bratanov
the Telerik team