apex:datatable> Datatable in Visualforce

-- Visualforce--

<apex:page controller="mydatatable">
 <apex:form >
     <apex:pageBlock >
         <apex:dataTable value="{!data}" var="dat" cellpadding="10" cellspacing="30" >
             
       
              <apex:column >
                      <apex:facet name="header"> Ids</apex:facet>
                      <apex:facet name="footer"> Ids</apex:facet>
                      <apex:outputText > {!dat.id}</apex:outputText>
              </apex:column>
               
              <apex:column >
                     <apex:facet name="header">names</apex:facet>
                     <apex:outputText > {!dat.name}</apex:outputText>
                     <apex:facet name="footer">names</apex:facet>
              </apex:column>
                     
         </apex:dataTable>
       
     </apex:pageBlock>
  </apex:form>
</apex:page>


-- Controller --

public class mydatatable {

    public List<Account> data { get; set; }

    public List<Account> getData() {
        return null;
    }
    public mydatatable(){
    data=[select id,name from account];
    system.debug(data);
    }

}


Comments

Popular posts from this blog

Community/Experience Cloud Interview Questions

Script to delete multiple records using Apex salesforce

Change Owner / Update record using Lightning Custom Button Salesforce