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
TN AdminTN Admin 

Is it possible to show/hide the table in vf template?

Is it possible to show/hide the table in vf template?
Best Answer chosen by TN Admin
TN AdminTN Admin
Got you thanks for your suppport @Jay . I have used repeat and variable tags and achieve the functionality.

All Answers

Jay Kumar PatilJay Kumar Patil
yes! it is possible try this:
<apex:page controller="HideAndShowController">
    <apex:form>
        <apex:commandButton action="{!addItem}" value="Add Item"
            reRender="outerPanel" />
        <apex:outputPanel id="outerPanel">
            <apex:pageBlock title="Selected Installed Items"
                id="id_ViewSelectedItem"
                rendered="{!IF(myList.size > 0, true, false)}">
                <apex:pageBlockTable value="{!myList}" var="ins">
                    <apex:column value="{!ins}" />
                </apex:pageBlockTable>
            </apex:pageBlock>
        </apex:outputPanel>
    </apex:form>
</apex:page>

 
TN AdminTN Admin
            <table style="{!IF(relatedTo.Contract_Extract_Approvals__r == null || relatedTo.Contract_Extract_Approvals__r == 0 , 'display: none;', '')}">
                <tr><td colspan="5" align="center" ><b>Non Standard Contract Items</b></td></tr>
                <tr>
                    <th>Area Impacted</th><th >Non Standard Contract Item</th>
                    <th>Reason</th><th>Approved By</th><th>Approval Date</th> 
                </tr>
            </table>

How to hide the above table am i doing wrong?
Jay Kumar PatilJay Kumar Patil
try to print this condition in console 
{!IF(relatedTo.Contract_Extract_Approvals__r == null || relatedTo.Contract_Extract_Approvals__r == 0 , 'display: none;', '')}

or in text area check what it returns. In this approach you are trying to change CSS on the basis of this Conditonal statement.But this function will return true or false Which is not an CSS and data will be availabe on page it doesnt matter table is visible or not so it is a bad practice any ways make this condition to return the Hidden attribute like in this  http://www.w3schools.com/tags/att_global_hidden.asp 
TN AdminTN Admin
Got you thanks for your suppport @Jay . I have used repeat and variable tags and achieve the functionality.
This was selected as the best answer