Hi Telerik,
I am attempting to make the follow scenario look visually more appealing to the end user:
-- User drag-and-drops a control onto the page. This starts a postback, I manually place a loading panel over the proper area.
-- User drag-and-drops a second control onto the page before the first postback has finished. I do not wish to cancel the firstpostback, I queue up the second postback and listen in the endRequest event.
Now, I would like to display a loading panel over both of these elements. I can do that perfectly fine. The problem lies in the fact that I cannot get a handle on whose request is ending inside of the endRequest method.
What this currently does is hide any visible loading panel on the screen before drawing a new one. I would like to keep a list of currently displayed loading panels, then, in end request, hide the appropriate loading panel. Is it possible to do this? All the examples I see just keep a single global variable and hide it in endRequest -- which will not work for my situation.
Thanks
Sean
I am attempting to make the follow scenario look visually more appealing to the end user:
-- User drag-and-drops a control onto the page. This starts a postback, I manually place a loading panel over the proper area.
-- User drag-and-drops a second control onto the page before the first postback has finished. I do not wish to cancel the firstpostback, I queue up the second postback and listen in the endRequest event.
Now, I would like to display a loading panel over both of these elements. I can do that perfectly fine. The problem lies in the fact that I cannot get a handle on whose request is ending inside of the endRequest method.
var
dockZoneDroppedOnID =
""
;
var
displayOverBaseID =
""
;
//Handles drawing the LoadingPanels over the correct elements when callbacks are occurring.
var
loadingPanel =
""
;
var
pageRequestManager = Sys.WebForms.PageRequestManager.getInstance();
var
postBackElement =
""
;
pageRequestManager.add_initializeRequest(initializeRequest);
pageRequestManager.add_endRequest(endRequest);
//This will display a loading panel over a control. It's useful to change what the loading panel is being
//displayed over in some scenarios because it just doesn't look quite right. e.g. when moving between panels
//the loading panel should only be the size of the pane that the dock is moving to, not the full size of the dock currently.
function
initializeRequest(sender, eventArgs) {
loadingPanel = $find(radAjaxLoadingPanel1ID);
loadingPanel.hide(postBackElement);
postBackElement = eventArgs.get_postBackElement().id;
//When drag and dropping the 'interesting' control isn't where we're coming from but where we're going to.
if
(dockZoneDroppedOnID !=
""
) {
postBackElement = $find(dockZoneDroppedOnID).get_parent().get_id();
dockZoneDroppedOnID =
""
;
}
else
if
(displayOverBaseID !=
""
) {
postBackElement = displayOverBaseID;
displayOverBaseID =
""
;
}
loadingPanel.show(postBackElement);
}
//This will hide the loading panel thats currently being displayed and,
//if the user decided to continue dropping things onto the page, it will fire
//the next event.
function
endRequest(sender, eventArgs) {
loadingPanel = $find(radAjaxLoadingPanel1ID);
loadingPanel.hide(postBackElement);
if
(droppedItemQueue.length > 0) {
droppedItemQueue.shift();
//Remove the ID of the control we just finished.
droppedItemQueue.shift();
//Remove the data for the control we just finished.
}
//If we've got more ajax requests queued up.
while
(droppedItemQueue.length > 0) {
var
uniqueDockZoneID = droppedItemQueue.shift();
var
data = droppedItemQueue.shift();
$find(radAjaxManagerID).ajaxRequestWithTarget(uniqueDockZoneID, $.toJSON(data));
}
if
( resizeQueue.length > 0) {
resizeQueue.shift();
//Remove the ID of the control we just finished.
}
while
(resizeQueue.length > 0) {
var
resizedID = resizeQueue.shift();
$find(radAjaxManagerID).ajaxRequestWithTarget(resizedID);
}
}
What this currently does is hide any visible loading panel on the screen before drawing a new one. I would like to keep a list of currently displayed loading panels, then, in end request, hide the appropriate loading panel. Is it possible to do this? All the examples I see just keep a single global variable and hide it in endRequest -- which will not work for my situation.
Thanks
Sean