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
RajaMohanRajaMohan 

Need to display if records present.

Hi

 

In my VF page, I am printing all the output from the controller. It is printing fine. I am printing the values for more objs. Some of the objs may be empty and some of the objs may contain value. I need to display the obj values which are having the values in it.

 

Sample code:

 

<table align="center" width=95%>

 

<tr colspan="5"><th>Fund Series Share Classes</th></tr>
<tr>
<th>Share Class Code</th><th>Series Share Class Type</th>
<th>Share Class Launch Date</th><th>Version</th>
<th>Status</th>

 

<apex:repeat value="{!allFund}" var="fund">
<tr>
<td>{!fund.Share_Class_Code__c}</td>
<td>{!fund.Series_Share_Class_Type__c}</td>
<td>{!fund.Share_Class_Launch_Date__c}</td>
<td>{!fund.Version__c}</td>
<td>{!fund.Status__c}</td>
</tr>
</apex:repeat>

</table>

 

The problem is, Any how the header row is created if the {!allFund} is empty.

 

Thanks

Raj

hisrinuhisrinu

You can make use of rendered as below.

 

rendered="{!NOT(ISNULL(allFund))}"

 

However in your getallFund method you have to check the list size and if the list size is greater than 0 then return the list else return null then it works fine.

RajaMohanRajaMohan

Hi Srini

 

Thanks for your reply. I tried by your way but no difference in the output. See the code, there I used the heading row before repeat. At any cost, the heading is displaying. So I need to use the rendered in the above only. I dont know how to proceed to achieve the end result.

 

Thanks

Raj

_Prasu__Prasu_

you can add that row in the <div> tag and show it or hide it depending upon the size of query result.

RajaMohanRajaMohan

Hi Eprasu,

 

Thanks for your reply. Will you please give me some codes of your idea to accomplish this?

 

Thanks

Raj

_Prasu__Prasu_

<div style="display:{!ShowHide}">

<tr colspan="5"><th>Fund Series Share Classes</th></tr>
<tr>
<th>Share Class Code</th><th>Series Share Class Type</th>
<th>Share Class Launch Date</th><th>Version</th>
<th>Status</th>

</tr>

</div>

 

in controller

String ShowHide {get; set;}

 

if(allFund != null && allFund.size() > 0)

ShowHide = 'block';

else

       ShowHide = 'none';

 

I hope this will helpful.