I am facing very unusual and silly issue. I have a vf page with render as pdf based on a condition. The page contains two tables. I am hiding first table conditionally so that second table can generate with proper pdf format. Here is what should happen: On button click of first table a new tab should open and first table should be hidden and second table should be visible in pdf format. What happens is a new tab opens but first table does not get hidden as the condition (isRender remains false) remains true. Here is the code for more understanding.
VF Page:
<apex:page id="pg" sidebar="false" showHeader="false" standardStylesheets="false" applyHtmlTag="false"
controller="MultipleSalarySlips" renderAs="{!if(isRender == true, "PDF", '')}">
<html>
<head>
</head>
<apex:form id="frm">
<table style = "margin-left: 560px;border: 2px solid;padding: 19px;border-radius:5px;background-color:#f1d1bf;display:{!if(isRender == true, 'None','')}" id = "firstTable">
<!--Table 1 code-->
</table>
<table style="width:100%;margin-top: 50px;border-collapse: collapse;page-break-after:always;">
<!--Table 2 code with repeate-->
</table>
Apex Class:
public with sharing class MultipleSalarySlips {
public String selectedToMonth{get;set;}
public String selectedFromMonth{get;set;}
public String selectedToYear{get;set;}
public String selectedFromYear{get;set;}
public List<Monthly_Salary_Details__c> monthlySalaryDetails{get;set;}
public List<WrpSalaryDetail> wrpSalaryDetails{get;set;}
public Monthly_Salary_Details__c msd{get;set;}
public Boolean isRender{get;set;}
public static Integer iq = 1;
public MultipleSalarySlips(){
wrpSalaryDetails = new List<WrpSalaryDetail>();
msd = new Monthly_Salary_Details__c();
isRender = false;
}