0

VF :

    <div class="slds-grid slds-grid--align-space">
     <div class="slds-col slds-size--1-of-12"> 
       <div class="slds-grid slds-wrap margin-top-right">
         <div class="slds-card">
          <div class="slds-card__header slds-grid">
            <div class="slds-media slds-media--center slds-has-flexi-truncate">      
              <div class="slds-media__body">
                   <h2 class="slds-text-heading--small slds-truncate">DETAILS</h2>
              </div>
             </div>
          <div class="slds-no-flex">
              <button class="slds-button slds-button--icon-border-filled">
              <svg aria-hidden="true" class="slds-button__icon">
                  <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#down"></use>
              </svg>        
              </button>
        </div>
      </div>
      <div class="slds-card__body">
           <apex:outputPanel id="details">
                <apex:dataTable value="{!CaseDetails}" var="account" id="theTable" rowClasses="odd,even" styleClass="tableClass">

 <apex:facet name="caption">table caption</apex:facet>
   <apex:facet name="header">table header</apex:facet>
    <apex:facet name="footer">table footer</apex:facet>
<apex:column>
  <apex:facet name="header">Name</apex:facet>
<apex:facet name="footer">column footer</apex:facet>
            <apex:outputText value="{!CaseDetails.Field1__c}"/>
        </apex:column>
        <apex:column>
            <apex:facet name="header">Owner</apex:facet>
            <apex:facet name="footer">column footer</apex:facet>
            <apex:outputText value="{!CaseDetails.Field2__c}"/>
            </apex:column>
           </apex:dataTable>
          </apex:outputPanel>
         </div>
        </div>                                      
       </div>
      </div>

Controller :

public List<Case> getCaseDetails()

{
    List<Case> cd = new List<Case>();

    if(cd == null) cd = [SELECT Field1 ,Field2  FROM Case WHERE Agency__c =:currentRecordId limit 1 ];

    return cd;
}

Where exactly am I going wrong?

Updated code :

  <apex:dataTable value="{!CaseDetails}" var="cs" id="theTable" 
                                         rowClasses="odd,even" styleClass="tableClass">
<apex:facet name="caption">table caption</apex:facet>
<apex:facet name="header">table header</apex:facet>
<apex:facet name="footer">table footer</apex:facet>
<apex:column>
    <apex:facet name="header">Name</apex:facet>
    <apex:facet name="footer">column footer</apex:facet>
    <apex:outputText value="{!cs.Field1__c}"/>
</apex:column>
<apex:column>
    <apex:facet name="header">Owner</apex:facet>
    <apex:facet name="footer">column footer</apex:facet>
    <apex:outputText value="{!cs.Field2__c}"/>
</apex:column>

Error again :Error: Unknown property 'VisualforceArrayList.Field1__c'

  • SFDCRookie.. Can you please close this question as well.. – Ratan Paul Jul 28 '16 at 9:47
  • SFDCRookie.. pls this is not a good practice to leave a question open – Ratan Paul Jul 29 '16 at 9:07
1

You need to use var value ie. account instad of CaseDetails inside dataTable

<apex:dataTable value="{!CaseDetails}" var="account" id="theTable" 
                                             rowClasses="odd,even" styleClass="tableClass">
    <apex:facet name="caption">table caption</apex:facet>
    <apex:facet name="header">table header</apex:facet>
    <apex:facet name="footer">table footer</apex:facet>
    <apex:column>
        <apex:facet name="header">Name</apex:facet>
        <apex:facet name="footer">column footer</apex:facet>
        <apex:outputText value="{!account.Field1__c}"/>
    </apex:column>
    <apex:column>
        <apex:facet name="header">Owner</apex:facet>
        <apex:facet name="footer">column footer</apex:facet>
        <apex:outputText value="{!account.Field2__c}"/>
    </apex:column>
</apex:dataTable>
  • I made the changes , but it's still throwing the same error. – SFDCRookie Jul 27 '16 at 8:30
  • 1
    @SFDCRookie are you getting same error? is there any other table? – Ratan Paul Jul 27 '16 at 8:58
  • There are no other table . Anything else needs to be done in the controller ? Any specific declarations? – SFDCRookie Jul 27 '16 at 9:08
  • @SFDCRookie can you please add your updated code in question? and also the error – Ratan Paul Jul 27 '16 at 9:10
  • @Ratan- Updated . Please let me know if there is anything wrong in the logic/syntax. – SFDCRookie Jul 27 '16 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.