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
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
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:
Hope this helps.
Thanks,
Princy.
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?
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:
var messageDiv = $("[name=" + "m_" + messageId + "]").parent();
messageDiv[0].scrollIntoView(true);
Here is the error message:
- Uncaught TypeError: Cannot call method 'scrollIntoView' of undefined Default.aspx:4280
-
jumpToMessageWithIdDefault.aspx:4280
-
jumpToMessageFromQueryStringDefault.aspx:4272
-
scrollToMessageFixDefault.aspx:4268
-
(anonymous function)Telerik.Web.UI.WebResource.axd:6
-
Telerik.Web.UI.RadWebControl.raiseEventTelerik.Web.UI.WebResource.axd:765
-
Type.callBaseMethodTelerik.Web.UI.WebResource.axd:6
-
a.RadEditor.raiseEventTelerik.Web.UI.WebResource.axd:10528
-
a.RadEditor.initializeTelerik.Web.UI.WebResource.axd:10614
-
Sys.Component.endUpdateTelerik.Web.UI.WebResource.axd:6
-
Sys._Application.endCreateComponentsTelerik.Web.UI.WebResource.axd:6
-
Sys._Application._doInitializeTelerik.Web.UI.WebResource.axd:6
-
(anonymous function)Telerik.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
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
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.