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
sanjeev342sanjeev342 

How do I display an empty records text for dataTable?

I would like my dataTable to display: No Records Found whenever there are no records to be retrieved.

 

Currently, I am doing this by putting an <apex:outputText/> field right outside of the dataTable. However, I would like the text to display inside of the dataTable, i.e. within any border it has.

 

How is this achievable? When moving the outputText within the dataTable tags, it became invisible.

 

Code:

<apex:dataTable value="{!ExamHistoryRecords}" var="ExamHistoryRecord" styleClass="myCFRETable" >
    <apex:column headerValue="Test Window">
        <apex:outputText value="{!ExamHistoryRecord.Exam_Window_Start_Date}"/>
    </apex:column>
    <apex:column headerValue="Result">
        <apex:outputText value="{!ExamHistoryRecord.Exam_Result}"/>
    </apex:column>
    <apex:column headerValue="Application Type">
        <apex:outputText value="{!ExamHistoryRecord.Application_Type}" style="white-space:nowrap;"/>
    </apex:column>
</apex:dataTable>
<apex:outputLabel value="{!ExamHistoryIsEmpty}" style="font-style:italic;"/>

 

Thanks,

Sanjeev