0

I have written an Apex method which sests the value to an automatic property called 'showPopup'.

public boolean showPopup {
           get;
           set;
      }

public void showWarningPopup(){
        Long remainingSessionTime  = getRemainingSecondsInSession();
        Integer remainingSessionTimeToInt = integer.valueof(remainingSessionTime);
        System.debug('Remaining Session Time------>'+remainingSessionTimeToInt);
        if(remainingSessionTimeToInt>5){
            System.debug('--Session is active--');
            showPopup = true;
        } else{
            System.debug('--Session is inactive--');
            showPopup = false;
        } 
    }

I have used Action Function to invoke this method and check the value of 'showPopup' property in javascript method of Visualforce Component as below.

 <apex:component controller = "ABCD">
    <apex:actionFunction name="showWarningPopup" action="{!showWarningPopup}" >
 </apex:actionFunction>




<Script>
      function displayPopup(){
           if (warningTimeOut == 0) {
                             if(dialogCounter < 10){
                                showWarningPopup();
                                if({!isShowPopup}){
                                console.log("isShowPopup---------->"+{!isShowPopup});
                                keepLoggedIn();
                            }else{
                                console.log("isShowPopup---------->"+{!isShowPopup});
                                if (dialogCounter < 1) {
                                $('.closemodalWrapper').hide();
                                $('.logoutComponent').show();
        
                                    }
                            }
        
        
                             }
                          
             }
     
     } 
 </Script>
</apex:component>

This component is being called inside a VF page as below.

<apex:page ..............>
      <c:AutoLogout />
</apex:page>

The invocation of controller method from actionfunction inside VF component causes to refresh the entire page. Is there anyway that we can avoid this. I tried passing the apex:outpotPannel id to reRender property of actionFunction. But that stopped invoking the controller method properly. Is there any way that we can stop refresh the page?

1 Answer 1

0

Try this :

<apex:actionFunction name="showWarningPopup" action="{!showWarningPopup}" reRender="false">

reRender="none" should also work.

refer to this question as well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .