Friday, July 25, 2014

PageBlock Table with Wizard in Visualforce page.

PageBlock Table with Wizard in Visualforce page.


Hi, 
In this post i am giving basic example of how to display data into <apex:pageblockTable>  .

Controller Class: 

Public class TableController{
 public List<Account> accList{get;set;}
 
 Public TableController(){
  accList= new List<Account>();
  accList= [select id,name,type,industry from Account];
 }
}

Visualforce Page:
<apex:page controller="TableController" wizard="true"> <apex:pageblock > <apex:pageblocktable value="{!accList}" var="a"> <apex:column headervalue="Account Name" value="{!a.Name}"/> <apex:column headervalue="Account Type" value="{!a.type}"/> <apex:column headervalue="Industry" value="{!a.industry}"/> </apex:pageblocktable> </apex:pageblock> </apex:page>


Test Class:
@isTest
Public class PagblockTable_Test {
 static testmethod void testPageblockTable(){
  //Test converage for the myPage visualforce page
  PageReference pageref = Page.PagblockTable;
  Test.setCurrentPageReference(pageref);
  
  // create an instance of the controller
  TableController tc= new TableController();

 }
}

Here is the out put of the page.

save image


In the <apex:page> tag i set as wizard="true" that's why the page is displayed like this.





0 comments:

Post a Comment

 
| ,