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
AtestAtest 

Does Dynamic Visualforce Component (Page block table) support "wrapper class"??

I was tring to build a Page Block table with Inner class list :

 

Component.Apex.PageBlockTable pbt = new Component.Apex.PageBlockTable(var = 'opl' , id='ptable') ;
pbt.expressions.value='{!opClassList}' ;

 

here opClassList is list of inner class elements.

 

and was try ing to add input field as column 

Component.Apex.InputField inputField = new Component.Apex.InputField();
inputField.expressions.value = '{!opl.ol.' + fName + '}';
column.childComponents.add(inputField);

 here the fname is API name.

 

The wrapper class looks like this :

 

public class otable
{
public Opportunity_Line__c ol{get;set;}
public boolean selected{get;set;}

public otable(Opportunity_Line__c o)
{
ol = o;
selected = false;
} 
}

 But it does not seem to work. But if I use Opportunity Line list directly then it works perfectly.  so my question is Does Dynamic Visualforce Component (Page block table) support "wrapper class"?? or there is  some prob with my code. Have any one tried wrapper class with Visualforce Component (Page block table) to get the selected list?

 

Thanks in advance :)

 

admintrmpadmintrmp

What is the output of the variable fName?

Should it not be:

 

Component.Apex.InputField inputField = new Component.Apex.InputField();
inputField.expressions.value = '{!opl.ol.' + fName + '}';
column.childComponents.add(inputField);

 

AtestAtest

Hai, 

 

Sry that was typo problem. It was 

inputField.expressions.value = '{!opl.ol.' + fName + '}';

and fname is the Field API. 

but it does not seem to work when I use the wrapper class . but it works perfectly when I use the normal object list and try to show it through page block table.

 

Have u tried it and does that work for you? any working example of "wrapper class" table will do. I just want to be sure that Dynamic Visualforce Component (Page block table) supports "wrapper class" or not.

admintrmpadmintrmp
I understand what you are doing, but I can't work out what you are trying to achieve with a wrapper class.

Could you post the whole code (from getting the fields, to setting them using the wrapper class, the wrapper class and the dynamic component builder and append).
AtestAtest
I am trying to build a table, show it in VF page then User would select some of the row , and those selected rows will be processed inside the apex. so for selection purpose I need the wrapper class Boolean field. I hope this answers what ur asking, will post the code in few hours.