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

Replacement for "RadEditorGlobalArray"

3 Answers 29 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Paul Haines
Top achievements
Rank 1
Paul Haines asked on 26 Nov 2008, 11:29 AM
We're currently upgrading from the old RadControls ASP.NET version to the "AJAX" version, (A.K.A. "Promotheus"), but can't seem to find what the "RadEditorGlobalArray" variable has been altered to. Is it still available, or has it been removed.replaced? If the latter, what should we use now?

As a bit of background, this is being used to try and locate the first editable RadEditor on a page, which has been dynamically created, (as there are a variable number of these all, within a DetailsView control, the IDs are auto-generated). What's the correct way of performing this for the new release?

Thanks,
Paul H

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 26 Nov 2008, 12:12 PM
Hi Paul,

You can use the $telerik.radControls; array which returns a reference to all Telerik controls on the page

var telerikArray = $telerik.radControls; //returns a reference to all Telerik controls on the page
for (i=0;i<telerikArray.length;i++)
{
    alert(telerikArray[i].get_id());
}

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Haines
Top achievements
Rank 1
answered on 26 Nov 2008, 12:20 PM
Thanks for the swift reply, but I have a few questions;
1) How can I use this to find the first or last, (as sometimes we require either option), editable RadEditor control on the page?
2) Which types of the telerik telerik controls does this contain?
3) If it's all of them, how can I tell what type each control in the array is?

Example javascript would be very much appreciated.

Thanks,
Paul H
0
Lini
Telerik team
answered on 28 Nov 2008, 11:34 AM
Hello Paul,

Here is some sample code:

function pageLoad() { 
    if (typeof ($telerik) != "undefined") { 
        if ($telerik.radControls && Telerik.Web.UI.RadEditor) { 
            for (var i = 0; i < $telerik.radControls.length; i++) { 
                var control = $telerik.radControls[i]; 
                if (Telerik.Web.UI.RadEditor.isInstanceOfType(control)) { 
                    //control is a radeditor object 
                } 
            } 
        } 
    } 

The code should be run after our controls have been initialized (after the Sys.Application.Init event). The code I have pasted includes some extra checks to make sure it does not fail if there is no RadEditor on the page. To check the type of the control I use the isInstanceOfType method.

Regards,
Lini
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Paul Haines
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Paul Haines
Top achievements
Rank 1
Lini
Telerik team
Share this question
or