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

Rad Editor Scrolls the page when loaded.

5 Answers 75 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Edward
Top achievements
Rank 1
Edward asked on 20 Sep 2012, 02:38 AM
On our site we have javascript that uses the ScrollIntoView(), but when the RadEditor loads, after ScrollIntoView has been called and the screen is in the correct place, it scrolls the user back up to the RadWindow.
Is there any way to disable the RadEditor from scrolling the screen back up?
Or is there a way I can call our scroll code again once the RadEditor has loaded?
Thanks,
Edward

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Sep 2012, 06:31 AM
Hi Edward,

You can call your function in OnClientLoad event of RadEditor as follows.

JS:
function OnClientLoad()
{
 setTimeout(function ()
 {
  // Your Code  
 }, 100);
}

Hope this helps.

Thanks,
Princy.
0
Edward
Top achievements
Rank 1
answered on 20 Sep 2012, 07:21 AM
I tried setting the OnClientLoad property of the RadEditor tag to the name of our method.
The method executes, but the jQuery selector we use to find the element we want to scroll to no longer finds anything.
I also tried using setTimeout on the first call, but with no luck.
Will combining the two change the result somehow?

Is your code equivalent?
Why would a selector not work when run on a callback from OnClientLoad?
0
Edward
Top achievements
Rank 1
answered on 21 Sep 2012, 01:54 AM
This is the snippet we execute to scroll to the element:
            var messageDiv = $("[name=" + "m_" + messageId + "]").parent();
            messageDiv[0].scrollIntoView(true);

Here is the error message:
  1. Uncaught TypeError: Cannot call method 'scrollIntoView' of undefined Default.aspx:4280
    1. jumpToMessageWithIdDefault.aspx:4280
    2. jumpToMessageFromQueryStringDefault.aspx:4272
    3. scrollToMessageFixDefault.aspx:4268
    4. Telerik.Web.UI.RadWebControl.raiseEventTelerik.Web.UI.WebResource.axd:765
    5. Sys.Component.endUpdateTelerik.Web.UI.WebResource.axd:6
    6. Sys._Application.endCreateComponentsTelerik.Web.UI.WebResource.axd:6
    7. Sys._Application._doInitializeTelerik.Web.UI.WebResource.axd:6
0
Edward
Top achievements
Rank 1
answered on 23 Sep 2012, 11:02 PM
@Princy: Your answer doesn't work for scrolling the page, it just returns the same error.
0
Rumen
Telerik team
answered on 24 Sep 2012, 12:04 PM
Hello,

For some reason this line var messageDiv = $("[name=" + "m_" + messageId + "]").parent(); returns null. You should make sure that messageDiv returns a correct reference to the object to which you want to scroll the page.

Kind regards,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Editor
Asked by
Edward
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Edward
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or