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

How to enumerate all editor instances on the page?

2 Answers 23 Views
Editor
This is a migrated thread and some comments may be shown as answers.
QualiWareUA
Top achievements
Rank 1
QualiWareUA asked on 19 Sep 2008, 09:41 AM

I need to enumerate all instances of RadEditor control on the page.

Scenario: there are several text editors on the page and OK and Cancel buttons. When user presses Cancel button I'd like to check if there are any changes made by the user and warn the user that the changes will be lost.

I can check if editor content has been changed by the following piece of code:

 
var manager = editor.get_commandsManager();  
var length = manager.getCommandsToUndo().length;  
 
... 

The question is how to get each text editor instance on the page? I can use, for instance, OnClientLoad event to collect text editor instances in some collection on client side, however I suppose there can be some other way to do that using existing features of client-side API?

2 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 23 Sep 2008, 06:38 AM
Hi Valeriy,

Yes, it is good practice to use the OnClientLoad event to collect RadEditor instances on client side.

Another way is to use the $telerik.radControls to get a reference to all telerik controls on the page, e.g.

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
QualiWareUA
Top achievements
Rank 1
answered on 23 Sep 2008, 08:33 AM
Thanks a lot, Rumen!
That's indeed what I need.
Tags
Editor
Asked by
QualiWareUA
Top achievements
Rank 1
Answers by
Rumen
Telerik team
QualiWareUA
Top achievements
Rank 1
Share this question
or