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

GetRadToolTipManager method in JavaScript

4 Answers 36 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
SUNIL
Top achievements
Rank 2
SUNIL asked on 19 Dec 2015, 06:21 PM

Is there a method like GetRadWindowManager for RadToolTipManager as shown in code snippet below?

The goal is to find the RadToolTipManager in an easy and transparent manner like in code below for RadWindowManager  in any content page, otherwise one needs to get the id from master page and then use $find, which is not an easy and transparent way of getting the manager object.

 

var omanager = GetRadWindowManager();

4 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 19 Dec 2015, 07:30 PM
Hi Sunil,

There isn't such a method. If you would like to see one implemented, I suggest you post your request in the feedback portal.

In the meantime, you can use the $telerik.radControls array (http://docs.telerik.com/devtools/aspnet-ajax/controls/telerik-static-client-library) and the isInstanceOfType method to check whether the array element is Telerik.Web.UI.RadToolTipManager.

Regards,
Marin Bratanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
SUNIL
Top achievements
Rank 2
answered on 19 Dec 2015, 10:07 PM

Hi Marin,

 First of all let me thank you for the super quick response. I wasn't expecting a reply so soon. You are excellent.

I did try the method which you suggested but it does not RadToolTipManager even though its there on the page. You can see a screenshot of this at this URL: http://screencast.com/t/bqWClXZfz10

Thanks

Sunil

0
SUNIL
Top achievements
Rank 2
answered on 19 Dec 2015, 10:18 PM

Hi Marin,

After some research, I came up with following code to get a radControl object of any type, since $telerik.radControls seems to have some limitations. All three methods seem to be working.

Thanks

Sunil

function getToolTipManager () {
       var components = Sys.Application.getComponents();
       for (var i = 0; i < components.length; i++) {
           if (components[i] instanceof Telerik.Web.UI.RadToolTipManager) {
               return components[i];
           }
       }
       return null;
   }
 
function getAllRadGrids () {
       var components = Sys.Application.getComponents();
       var allradgrids = [];
       for (var i = 0; i < components.length; i++) {
           if (components[i] instanceof Telerik.Web.UI.RadGrid) {
              allradgrids.push(components[i]);
           }
       }
       return allradgrids;
   }
 
function getAllRadControlObjectsOfType (radControlType) {
       var components = Sys.Application.getComponents();
       var allradcontrolsofAType = [];
       for (var i = 0; i < components.length; i++) {
           if (components[i] instanceof radControlType) {
               allradcontrolsofAType.push(components[i]);
           }
       }
       return allradcontrolsofAType;
   }

0
SUNIL
Top achievements
Rank 2
answered on 19 Dec 2015, 11:10 PM

Using the above code, one could get RadToolTipManager on a page using JavaScript code as below. 

//get the first RadToolTipManager on the current page
var toolTipManager = getToolTipManager();
 
//get all RadToolTipManager instances as an array object, on the current page
var toolTipManagers = getAllRadControlObjectsOfType(Telerik.Web.UI.RadToolTipManager);

 

Also, one could get radControl of any type using JavaScript like below. The array returned would contain all instances of that radControl type on the current page. It would have been nice if these methods were part of $telerik static library since these utility methods are very useful.

 

//get all instances of RadGrid on current page
var allRadGrids = getAllRadControlObjectsOfType(Telerik.Web.UI.RadGrid);
 
//get all instances of RadGrid on current page
var allRadGrids = getAllRadControlObjectsOfType(Telerik.Web.UI.RadGrid);
 
//get all instances of RadAjaxLoadingPanel on current page
var allRadGrids = getAllRadControlObjectsOfType(Telerik.Web.UI.RadAjaxLoadingPanel);
 
//get all instances of RadTreeView on current page
var allRadGrids = getAllRadControlObjectsOfType(Telerik.Web.UI.RadTreeView);

Tags
ToolTip
Asked by
SUNIL
Top achievements
Rank 2
Answers by
Marin Bratanov
Telerik team
SUNIL
Top achievements
Rank 2
Share this question
or