+ Start a Discussion

Remove Row Dynamically from a Pageblocktable

My controller has a method that returns a list.

Based on certain criteria I would like to hide the results from the DataBlockTable. For example if Revenue__c < 300.


I know this could be done by changing the SOQL query to filter the results so the list just does not contain the unwanted values. However I would prefer to keep the list as is and filter on the VisualForce side. Is there a syntax to use render  within a DataBlockTable so it will conditionally show the rows?

Ritesh AswaneyRitesh Aswaney

Sure, you can use the rendered attribute to conditionally render rows based on a boolean condition


<apex:outputText value="{!bindVariable}"  rendered="{!revenue__c < 300}" />



Thank you for the response. Here is a code sample: Small Group ({!TBR_Selection__c.Small_Group_Average__c})ReviewerConnection ({!TBR_Selection__c.Connection_Small_Group__c})Strategy({!TBR_Selection__c.Strategy_Small_Group__c}) The concern I have is that using the render attribute on a particular apex:output tag is in reality only hiding a single column rather than the whole row. Or do I use the Render tag on all column tags? Perhas there is another tag I can wrap the column tags to accomplish what I want? Or does hiding a single OutputText tag suffcient to hide the entire rows content?
Shailesh DeshpandeShailesh Deshpande
Please refer the below link:


Here I am. Keeping the original list as it is, but changing the wrapper class list based on what row is selected. I am using checkboxes to identify which row to add/remove dynamically. You can modify the class to use your conditions.