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
Nitish 73Nitish 73 

Custom Button conditional render

Hi All, 

I have a requirement where I need to render a button based on certain condition. 
The condition is 
  • Show the 'View All' button if there are more than 3 records in the table that is displayed on the visualforce page. So that when they click that , it will show more records. 
Kind of like mimicing 'Show more' link in related list records. 
 
<apex:commandButton rendered="{!if(({!AC.size} >3) ,true,false)}"   value="View All" onclick="return false;" html-data-toggle="modal" html-data-target="#myModal" styleClass="btn-success"/>
It is throwing an error . Can anybody help me with this? 


Thanks
Nitish
 
Best Answer chosen by Nitish 73
Abhishek BansalAbhishek Bansal
Hi Nitish.

Please change your rendered code as mentioned below :
<apex:commandButton rendered="{!if(AC.size > 3  ,true,false)}"   value="View All" onclick="return false;" html-data-toggle="modal" html-data-target="#myModal" styleClass="btn-success"/>
Let me know if you have any other issue.

Thanks,
Abhishek

All Answers

Abhishek BansalAbhishek Bansal
Hi Nitish.

Please change your rendered code as mentioned below :
<apex:commandButton rendered="{!if(AC.size > 3  ,true,false)}"   value="View All" onclick="return false;" html-data-toggle="modal" html-data-target="#myModal" styleClass="btn-success"/>
Let me know if you have any other issue.

Thanks,
Abhishek
This was selected as the best answer
Nitish 73Nitish 73
Thanks a lot, Abhishek. It works :)

Really appreciate it. 


Thanks
Nitish 
Abhishek BansalAbhishek Bansal
Hi Nitish,

If you have got your solution than please close this question by marking it as Solved so that it would be helpful for others to find a solution and also avoids the confusion.

Thanks,
Abhishek
Nitish 73Nitish 73
Done Abhishek !


Thanks
Nitish