function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dhaker HassineDhaker Hassine 

calendar div doesn't show in aura:renderIf tag

Hello everyone, 

In wanted to refresh a div containing a full calendar. I put this div into aura:renderIf tag, and in the JS controller I make a window.setTimeout method. 

The div exists in page inspection, but doesn't reappear in the body of the page. 

Anyone knows this problem? 

Or any other suggestion to refresh this div?
Here are codes: 

1. Calend.cmp

<aura:renderIf isTrue="{!v.truthy}">
             
            <ltng:require scripts="{!join(',', 
            $Resource.fullcalendar + '/fullcalendar/jquery.min.js', 
            $Resource.fullcalendar + '/fullcalendar/jquery-ui.min.js',
            $Resource.fullcalendar + '/fullcalendar/moment.min.js',
            $Resource.fullcalendar + '/fullcalendar/fullcalendar.min.js')}"
   styles="{!$Resource.fullcalendar + '/fullcalendar/fullcalendar.min.css'}"
   
   afterScriptsLoaded="{!c.scriptsLoaded}" />
     <div>Hi from test div</div>
            <div id='calendar'></div>
        </aura:renderIf>


2.CalendController.js

component.set("v.truthy",false);
              window.setTimeout(
                  $A.getCallback(function() {   
                      component.set("v.truthy",true);
                     // setTimeout($('#calendar').fullCalendar(), 3000);
                      console.log("I'm in setTimeOut function");
                      console.log(component.get('v.truthy'));
                  })
                  ,3000);
Best Answer chosen by Dhaker Hassine
Dhaker HassineDhaker Hassine
Hello! I manage to solve it by changing the renderIf tag by a simple aura:if tag 

All Answers

David Zhu 🔥David Zhu 🔥
It is because once you set v.truty to false, the script is not run again.

you may use 
<div display="{!if(v.truthy,'','none')}"> 
to replace <aura::renfderIf>

by using <div>, the section is rendered by hiden, the script should alway be running.
Dhaker HassineDhaker Hassine

Hello David! 

No it doesn't work! :( 

Dhaker HassineDhaker Hassine
Hello! I manage to solve it by changing the renderIf tag by a simple aura:if tag 
This was selected as the best answer