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

Find all calendar/time popups

7 Answers 113 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
vbl vbl
Top achievements
Rank 1
vbl vbl asked on 27 May 2009, 05:38 AM
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();
            }
        }

7 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 30 May 2009, 06:22 AM
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.
0
vbl vbl
Top achievements
Rank 1
answered on 01 Jun 2009, 01:28 AM
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
0
Georgi Krustev
Telerik team
answered on 02 Jun 2009, 03:34 PM
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.
0
vbl vbl
Top achievements
Rank 1
answered on 27 Jul 2009, 05:23 AM
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(); 
            } 
        } 
    } 

0
Tsvetoslav
Telerik team
answered on 29 Jul 2009, 01:26 PM
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.
0
vbl vbl
Top achievements
Rank 1
answered on 30 Jul 2009, 12:00 AM
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(); 
            } 
        } 
    } 

0
Richard M
Top achievements
Rank 1
answered on 18 Nov 2010, 03:30 PM
// 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>
Tags
Calendar
Asked by
vbl vbl
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
vbl vbl
Top achievements
Rank 1
Tsvetoslav
Telerik team
Richard M
Top achievements
Rank 1
Share this question
or