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
Sebastian75Sebastian75 

PageblockTable with Dynamic Visualforce Components

I'm starting using DVC (pilot feature enabled) and I was wondering if the apex:column implementation of the PageBlockTable is incorrect or if I missed something. When trying to build a Pageblocktable an d iterate over a List<Contact> the column contains the right numbers of rows, but the values are not displayed. Instead, the VF meta-tag is diplayed: {!var.columnName}

 

My controller class looks like this (don't search any point in it, it's just a test...):

public with sharing class GenericMultiEditObjectController {
	public String objectName;
	public String ParentObjectId;
	public list<Contact> objList {get;set;}
	

	/*================
	CONSTRUCTOR
	==================*/
	public GenericMultiEditObjectController(){
		mainInit();
	}
	
	private void mainInit(){
		Map<String,String> paramMap = ApexPages.currentPage().getParameters();
		
		if (paramMap.containsKey('object')) objectName = paramMap.get('object');
		if (paramMap.containsKey('parentObjectId')) parentObjectId = paramMap.get('parentObjectId');
	
		objList = new List<Contact>();
		for (Contact oContact:[select id, firstName,LastName from Contact limit 20]){
			objList.add(oContact);
		}
	}
	
	public Component.Apex.PageBlockTable getRlTable(){
		Component.Apex.PageblockTable table = new Component.Apex.PageblockTable();
		table.value=objList;
		table.var = 'genObj';
		

		
		Component.Apex.Column firstNameCol = new Component.Apex.Column();
		firstNameCol.value = '{!genObj.FirstName}';

		table.childComponents.add(firstNameCol);

		return table;
	}

}

 

And my VF page:

 

<apex:page controller="GenericMultiEditObjectController">
	
	<apex:form >
		<apex:pageblock >
		
			<apex:dynamicComponent componentValue="{!rlTable}" />
			
		
		</apex:pageblock>
	</apex:form>	
	
</apex:page>

 

I put the result in attachment...

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Sebastian75Sebastian75

topic closed:instead of using column.value='{!var.fieldName}'I should have used:column.expressions.value='{!var.fieldName}'