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
jucuzoglujucuzoglu 

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}" />

 

http://bobbuzzard.blogspot.co.uk/2011/02/visualforce-re-rendering-woes.html

jucuzoglujucuzoglu
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:

http://boards.developerforce.com/t5/Visualforce-Development/Add-Row-functionality-in-VisualForce/m-p/358921#M42957

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.