Conditionally showing the Loading panel for Scheduler

3 posts, 0 answers
  1. Ellie
    Ellie avatar
    10 posts
    Member since:
    Dec 2019

    Posted 23 Jul 2020 Link to this post

    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. Ellie
    Ellie avatar
    10 posts
    Member since:
    Dec 2019

    Posted 24 Jul 2020 Link to this post

    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>
  3. Peter Milchev
    Admin
    Peter Milchev avatar
    880 posts

    Posted 28 Jul 2020 Link to this post

    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

Back to Top