Find all calendar/time popups

8 posts, 0 answers
  1. vbl vbl
    vbl vbl avatar
    18 posts
    Member since:
    Apr 2005

    Posted 27 May 2009 Link to this post

    I have tried to get this working for the 2009 release, but I am having no luck.

    http://www.telerik.com/community/forums/aspnet/calendar/popup-calendar-does-not-close-when-clicking-on-scrollbars.aspx

    What I need to be able to do is close all (telerik) datepicker, timepicker, colorpicker, combo popup windows when I scroll, as I do not know the name of these controls at design time as they are dynamically loaded I need some way of getting them all.

    Combo is easy as there is an array

            function closeCombos() {
                for (i = 0; i < Telerik.Web.UI.RadComboBox.ComboBoxes.length; ++i) {
                    Telerik.Web.UI.RadComboBox.ComboBoxes[i].hideDropDown();
                }
            }
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 30 May 2009 Link to this post

    Hello,

    To achieve your goal you can use the static collection Telerik.Web.UI.RadDatePicker. You can get a collection of the ids of all open calendars. Hence you should traverse it and call Hide() method for each open calendar. Here is a code snippet showing how to achieve this:
           if (Telerik.Web.UI.RadDatePicker){ 
                var popups = Telerik.Web.UI.RadDatePicker.PopupInstances; 
                for(var item in popups) 
                {                 
                    if ($find(item) && 
                        ( 
                            ($find(item).get_id().indexOf(this._owner.ClientID + "_" + "gdtcSharedCalendar") > -1) || 
                            ($find(item).get_id().indexOf(this._owner.ClientID + "_" + "gdtcSharedTimeView") > -1) 
                        ) 
                       ) 
                    { 
                        Telerik.Web.UI.RadDatePicker.PopupInstances[item].Hide(); 
                    } 
                } 
     
            } 

    Kind regards,
    Georgi Krustev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. vbl vbl
    vbl vbl avatar
    18 posts
    Member since:
    Apr 2005

    Posted 31 May 2009 Link to this post

    Hi,

    I am getting this._owner is undefinied (in FF3), I also could not see any controls with names which contain gdtcSharedCalendar and gdtcSharedTimeView in the source for the page.

    Dll: 2009.1.402.20

    If I remove the follow the data picker now closes but the time picker stays open.

    &&  
                        (  
                            ($find(item).get_id().indexOf(this._owner.ClientID + "_" + "gdtcSharedCalendar") > -1) ||  
                            ($find(item).get_id().indexOf(this._owner.ClientID + "_" + "gdtcSharedTimeView") > -1)  
                        )  

    Am I correct in assume that PopupInstances is an internal telerik method as I could not find its documentation.

    Thanks
  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 02 Jun 2009 Link to this post

    Hello,

    You can try this code snippet which should covers your needs:
                if (Telerik.Web.UI.RadDatePicker) { 
                    var popups = Telerik.Web.UI.RadDatePicker.PopupInstances; 
                    for (var item in popups) { 
                        if ($find(item)) { 
                            Telerik.Web.UI.RadDatePicker.PopupInstances[item].Hide(); 
                        } 
                    } 
     
                } 

    Let me know if I am missing something.

    Kind regards,
    Georgi Krustev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. vbl vbl
    vbl vbl avatar
    18 posts
    Member since:
    Apr 2005

    Posted 27 Jul 2009 Link to this post

    That worked for the date picker so I though I would try and use the same thing for the time picker, but it stays open as Telerik.Web.UI.RadTimePicker is false. Any ideas?

        if (Telerik.Web.UI.RadTimePicker) { 
            var popups = Telerik.Web.UI.RadTimePicker.PopupInstances; 
            for (var item in popups) { 
                if ($find(item)) { 
                    Telerik.Web.UI.RadTimePicker.PopupInstances[item].Hide(); 
                } 
            } 
        } 

  7. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 29 Jul 2009 Link to this post

    Hi vbl vbl,

    Try using Telerik.Web.UI.RadDateTimePicker.TimePopupInstances instead.

    Best wishes,
    Tsvetoslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. vbl vbl
    vbl vbl avatar
    18 posts
    Member since:
    Apr 2005

    Posted 29 Jul 2009 Link to this post

    Thanks I have my date and time popup closing when I scroll now

    function closeDates() { 
        if (Telerik.Web.UI.RadDatePicker) { 
            var popups = Telerik.Web.UI.RadDatePicker.PopupInstances; 
            for (var item in popups) { 
                if ($find(item)) { 
                    Telerik.Web.UI.RadDatePicker.PopupInstances[item].Hide(); 
                } 
            } 
        } 
     
        if (Telerik.Web.UI.RadDateTimePicker) { 
            var popups = Telerik.Web.UI.RadDateTimePicker.TimePopupInstances; 
            for (var item in popups) { 
                if ($find(item)) { 
                    Telerik.Web.UI.RadDateTimePicker.TimePopupInstances[item].Hide(); 
                } 
            } 
        } 

  9. Richard M
    Richard M avatar
    15 posts
    Member since:
    Feb 2010

    Posted 18 Nov 2010 Link to this post

    // This is how I got it to work.  I have no time pickers

    <script type=
    "text/javascript">
        function MainSplitterOnClientLoaded(sender, eventArgs) {
            var pane = sender.getPaneById("<%= rpMainContent.ClientID %>");
            var contentElement = pane.getContentElement();
            contentElement.onscroll = function () {
                for (i = 0; i < Telerik.Web.UI.RadComboBox.ComboBoxes.length; ++i) {
                    Telerik.Web.UI.RadComboBox.ComboBoxes[i].hideDropDown();
                }
     
                for (var item in Telerik.Web.UI.RadDatePicker.PopupInstances) {
                    if ($find(item))
                    {
                            Telerik.Web.UI.RadDatePicker.PopupInstances[item].Hide();
                    }
                }
            };
        }
    </script>
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017