GetRadToolTipManager method in JavaScript

5 posts, 0 answers
  1. Sunil
    Sunil avatar
    230 posts
    Member since:
    Jan 2004

    Posted 19 Dec 2015 Link to this post

    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();

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 19 Dec 2015 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sunil
    Sunil avatar
    230 posts
    Member since:
    Jan 2004

    Posted 19 Dec 2015 in reply to Marin Bratanov Link to this post

    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

  5. Sunil
    Sunil avatar
    230 posts
    Member since:
    Jan 2004

    Posted 19 Dec 2015 in reply to Marin Bratanov Link to this post

    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;
       }

  6. Sunil
    Sunil avatar
    230 posts
    Member since:
    Jan 2004

    Posted 19 Dec 2015 Link to this post

    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);

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017