You need to sign in to do that
Don't have an account?

Hide table
Good day!
I have a table:
<apex:column style="text-align:" headervalue="{!$Label.Goal_set_in}">
<apex:outputText value="{0,date,MMMM','yyyy}">
<apex:param value="{!GT.CreatedDate}" />
</ Apex: outputText>
</ Apex: column>
<apex:column style="text-align:" headervalue="{!$Label.Due_Date}">
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
<apex:param value="{!GT.Targeted_Due_Date__c}" />
</ Apex: outputText>
</ Apex: column>
<apex:column style="text-align:" headervalue="{!$Label.Status}" value="{!GT.Status__c}" />
</ Apex: DataTable>
The source for this table:
{
get
{
List<Action_Goal__c> MyActGoalsDescList = new List<Action_Goal__c>();
if ((MyGoalType != null) && (MyGoalType !=''))
{
// Date MyDate = getStartDate();
Map<id,Action_Goal__c> aMap = new Map<id,Action_Goal__c>(
[select Goal_Description__c ,id, Goal_Type__c, Targeted_Due_Date__c, Name, Status__c, CreatedDate
From Action_Goal__c
Where ToLabel(Goal_Type__c) =:MyGoalType
AND ((CALENDAR_Year(Targeted_Due_Date__c)= :MyYear AND CALENDAR_Month(Targeted_Due_Date__c)= :MyMonth)
OR ( Status__c !=:BusinessPlanUtil.Completed ) )
AND CreatedById =:MyUserID
]);
if (aMap.isEmpty())
{
Action_Goal__c tmp = new Action_Goal__c();
tmp.Goal_Description__c =' ';
MyActGoalsDescList.add(tmp);
}
else
{
MyActGoalsDescList = aMap.values() ;
MyActGoals= new List<MyActGoals__c> ();
Set<id> whatIDSet = aMap.keySet() ;
MyActGoals = getMyActGoalsList(whatIDSet);
}
}
return MyActGoalsDescList;
}
set;
}
How do I make sure that if MyActGoalsDescList empty table does not render?
Hi,
You can use the 'rendered' attribute of apex:dataTable.
eg: <apex: DataTable value = "{! MyActGoalsDescList}" var = "GP" rowClasses = "odd, even" styleClass = "bhpb-act bhpb-base bot-margin rendered={!MyActGoalsDescList.size>0}>
The rendered attribute will display the table only when the condition within the expression tag evaluates to true. i.e if your list size > 0.
All Answers
Hi,
You can use the 'rendered' attribute of apex:dataTable.
eg: <apex: DataTable value = "{! MyActGoalsDescList}" var = "GP" rowClasses = "odd, even" styleClass = "bhpb-act bhpb-base bot-margin rendered={!MyActGoalsDescList.size>0}>
The rendered attribute will display the table only when the condition within the expression tag evaluates to true. i.e if your list size > 0.
Спасибо!!!