I have created controller and visual force pages. In my controller using field sets it's working fine. My VF pages having problem for unknown property. What should I need to change in my Visual force page and controller. I mention below error line in my VF page.
public with sharing class PageBlockTableFieldSetExample {
public List<Account> accounts { get; private set; }
public List<String> headers { get; private set; }
public List<RowExample> rows { get; private set; }
//public string accounts1{get;set;}
public PageBlockTableFieldSetExample() {
String queryFields = '';
for(Schema.FieldSetMember f : SObjectType.Account.FieldSets.Example_Fieldset.getFields()) {
if(queryFields.length() > 0) {
queryFields += ', ';
}
queryFields += f.getFieldPath();
}
//Query the records you want to display
this.accounts = Database.query(
' SELECT ' +
queryFields +
' FROM ' +
' Account ' +
' WHERE ' +
' AccountNumber = null ' +
' LIMIT 10 ');
//Setup the row of classes example
this.headers = new List<String> { 'Monday', 'Tuesday', 'Wednesday' };
this.rows = new List<RowExample>();
for(Integer i = 0; i < 3; i++) {
this.rows.add(new RowExample(this.headers.size()));
}
}
public class RowExample {
//A variable number of cells in different rows will result in
public final List<String> cells { get; private set; }
public RowExample(Integer length) {
this.cells = new List<String>();
for(Integer i = 0; i < 3; i++) {
this.cells.add('Cell ' + (math.random() * 10).intValue());
}
}
}
}
VF Page:
<apex:page>
<apex:form>
<apex:pageBlock id="block">
<apex:pageBlockTable id="table" var="account" value="{!accounts}">//error Line
<apex:column headerValue="Account Name" value="{!account.Name}" />
<apex:repeat var="f" value="{!$ObjectType.Account.FieldSets.Example_Fieldset}">
<apex:column headerValue="{!f.label}">
<apex:inputField value="{!account[f]}" />
</apex:column>
</apex:repeat>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>