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

Conditionally showing the Loading panel for Scheduler

2 Answers 83 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Ellie
Top achievements
Rank 1
Ellie asked on 23 Jul 2020, 12:12 PM

Hi,

 

i have attached a LoadingPanel to my RadScheduler.How can I get it to display when loading/saving  the AdvancedForm, but not for every single postback on the form. I have a multitude of checkboxes on there & getting the loading screen for every tick/untick is really slowing things down.

 

I've had a brief look at OnRequestStart, but I don't see how to narrow down the postback event being applied to the scheduler.

 

Thanks,

Ellie

 

01.            var currentLoadingPanel = null;
02.            var currentUpdatedControl = null;
03.            function RequestStart(sender, args) {
04.                currentLoadingPanel = $find("<%= RadAjaxLoadingPanel1.ClientID %>");
05. 
06.                if (args.get_eventTarget() == "<%= RadScheduler1.UniqueID %>") {
07.                    currentUpdatedControl = "<%= RadScheduler1.ClientID %>";    
08. 
09.<%--something needs to go here to identify the postbacks i do / don't want the panel for --%>
10.                
11.                    currentLoadingPanel.show(currentUpdatedControl);
12.                }
13.            }

2 Answers, 1 is accepted

Sort by
0
Ellie
Top achievements
Rank 1
answered on 24 Jul 2020, 09:58 AM

I thought I got slightly further with the javascript, but on putting an alert in RequestStart it seems that it is not called when the elements on the Advanced Form Control do a postback. With 52 check boxes (weeks) on the screen for controlling recurrence it's far too much of a delay

 

 

<script type="text/javascript">
    var currentLoadingPanel = null;
    var currentUpdatedControl = null;               
    function RequestStart(sender, args) {                                       
         currentLoadingPanel = $find("<%= RadAjaxLoadingPanel1.ClientID %>");
         
        if (args.get_eventTarget() == "<%= RadScheduler1.UniqueID %>" && (!args.get_eventTarget().includes("CheckWeeks"))) {
            currentUpdatedControl = "<%= RadAjaxLoadingPanel1.ClientID %>";
            currentLoadingPanel.show(currentUpdatedControl);
        }                   
    }  
</script>
0
Peter Milchev
Telerik team
answered on 28 Jul 2020, 08:31 AM

Hello Ellie,

If the Scheduler is set as an updated control, then it will be updated on every postback triggered by a control set as AjaxControl and has the scheduler in its UpdatedControls collection. 

If you just need to manipulate the Loading panel, then you can add some additional checks. For example, you can use the browser's console to get a better understanding on what parameters and arguments you have in the RequestStart:

<telerik:RadCodeBlock runat="server">

    <script>
        function OnRequestStart(sender, args) {
            var scheduler = $find("<%= RadScheduler1.ClientID %>");

            console.log(args.get_eventArgument())
            console.log(args.get_eventTargetElement());
            // if it is the scheduler 
            if (scheduler.get_element() == args.get_eventTargetElement()) {
                // check the .command property 
                var schedulerArguments = JSON.parse(args.get_eventArgument())
                console.log(schedulerArguments)
            }

            // if it is the cancel button of the advanced form
            if ($telerik.$(scheduler.get_element()).find(".rsAdvEditCancel")[0] == args.get_eventTargetElement()) {

            }
        }
    </script>
</telerik:RadCodeBlock>

Regards,
Peter Milchev
Progress Telerik

Tags
Scheduler
Asked by
Ellie
Top achievements
Rank 1
Answers by
Ellie
Top achievements
Rank 1
Peter Milchev
Telerik team
Share this question
or