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
Jonathan SpinkJonathan Spink 

How can the visibility of a button in a VF column be made to depend on the field value for that row?

I have rows of data to display on a VF form and on some rows I want to hide the button based on a field value for that row. Everything I try hides the entire column, e.g.

<apex:dataTable value="data" var="c">
    <apex:column>
        <apex:outputText value="{!c.field}/>
        <apex:outputPanel rendered="{!c.rowBoolean}">
            <button type="button">process...</button>
        </apex:outputPanel>
    </apex:column>
</apex:dataTable>
 
Best Answer chosen by Jonathan Spink
Virendra ChouhanVirendra Chouhan

Create a wrapper class. Instead of the data, loop on wrapper.
Inside wrapper, set a avariable for each row (true/false) and use the variable to hide/show the button inside datatable.

All Answers

Virendra ChouhanVirendra Chouhan

Create a wrapper class. Instead of the data, loop on wrapper.
Inside wrapper, set a avariable for each row (true/false) and use the variable to hide/show the button inside datatable.

This was selected as the best answer
Jonathan SpinkJonathan Spink
Thanks Virendra. Actually I had used a wrapper, but following your reply I reviewed the code and noticed a typo. Corrected that and it worked! Anyway, you confirmed I was on the right track!