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
Rick RollRick Roll 

Hide Outputlink for a Certain Row Value in a Pageblocktable

I have this table

Platform        Status        Action
 
Platform1       OK           Setup | Edit
Platform2       NA           Setup | Edit
Platform3       OK           Setup | Edit

I want to remove " Setup | " when Status row is OK, else default.
How do I apply this?

here is my code for the table
<apex:pageBlock >
                    <apex:pageBlockTable value="{!platforms}" var="field" >
                        <apex:column headerValue="PLATFORM" value="{!field.Name}"/>
                        <apex:column headerValue="STATUS" value="{!field.Status__c}"/>
                        <apex:column headerValue="ACTION">
                                <apex:commandLink value="Setup" action="{!setup}"/>
                                <apex:outputText >&nbsp;&nbsp;|&nbsp;&nbsp;</apex:outputText>
                                <apex:commandLink value="Edit" action="{!defedit}">
                                </apex:commandlink>
                        </apex:column>
                        <apex:column />
                    </apex:pageBlockTable> 
                </apex:pageBlock>


Thanks!
Ajay K DubediAjay K Dubedi
Hi Rick,
Take a bollean variable in your controller class ann set it true or false on the basis of the status i.e when ever the status is Ok make the variable true else let it be false :
 
Eg : boolean test=fase;
 
if(status==Ok){
test=true;
}
 
<apex:commandLink value="Setup" action="{!setup}" rendered={!test}/>
 
Mark i best if it helps to you.
Eswar Prasad@Sfdc11Eswar Prasad@Sfdc11
HI Rick Roll,
pls see below code above requirement i done here,but i can taken example customobject if can keep your object

class 
public List<customobject__c>platforms{get;set;}
public Boolean link{get;set;}
controller
platforms=new List<Customobject__c>();
platforms=[select name,status__c from Customobject__c];
if(platforms.status__c==ok){
link=false;
}
else{
link=true;
}

visualforce
<apex:pageBlock >
                    <apex:pageBlockTable value="{!platforms}" var="field" >
                        <apex:column headerValue="PLATFORM" value="{!field.Name}"/>
                        <apex:column headerValue="STATUS" value="{!field.Status__c}"/>
                        <apex:column headerValue="ACTION">
                                <apex:commandLink value="Setup" action="{!setup}" rendered="{!link}"/>
                                <apex:outputText >&nbsp;&nbsp;|&nbsp;&nbsp;</apex:outputText>
                                <apex:commandLink value="Edit" action="{!defedit}">
                                </apex:commandlink>
                        </apex:column>
                        <apex:column />
                    </apex:pageBlockTable> 
                </apex:pageBlock>


If you get the answer, please mark it as the correct answer. It will be a help to others who are facing the same problem later.

Regards
Eswar Prasad