• Mikhail Ushakov
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I have the following Apex codes that works just fine as a static object, but I need to build a collection of these dynamically in a controller.  When I try to build the exact same thing in the code, I get very weird results.

Here's the Apex code that works fine:
<apex:PageBlockTable value="{!tableRows}" var="row">
                <apex:column value="{!row.question.question__c}"/> 
                <apex:column headerValue="Response">
                    <apex:selectList size="1" id="status" value="{!row.quote.Quantity__c}" multiselect="false" rendered="{!IF(row.question.answerType__c=='Yes/No', 'true','false')}">
                        <apex:selectOption itemLabel="Yes" itemValue="1"/>
                        <apex:selectOption itemLabel="No" itemValue="0"/>
                    </apex:selectList>
                    <apex:inputField type="number" required="false" value="{!row.quote.Quantity__c}" rendered="{!IF(row.question.answerType__c=='Numeric', 'true','false')}"/>
                </apex:column>    
                <apex:column value="{!row.question.tip__c}"/>
            </apex:PageBlockTable>


Here is the controller code that isn't working:

public Component.Apex.PageBlockTable getSurveyTable()
    {
        Component.Apex.PageBlockTable table = new Component.Apex.PageBlockTable(value=tableRows, var='row');
        
        //Question Column
        Component.Apex.Column qColumn = new Component.Apex.Column();
        qColumn.expressions.value = '{!row.question.question__c}';
        table.childComponents.add(qColumn);
        
        //Response Column
        Component.Apex.Column rColumn = new Component.Apex.Column();
        rColumn.headerValue = 'Response';
        //Yes/No Selection List
        Component.Apex.selectList sList = new Component.Apex.selectList(size=1, id='status', value='{!row.quote.Quantity__c}', multiselect=false);
        sList.expressions.rendered = '{!row.question.question__c != "Yes/No"}';
        sList.childComponents.add(new Component.Apex.selectOption(itemLabel='Yes', itemValue='1'));
        sList.childComponents.add(new Component.Apex.selectOption(itemLabel='No', itemValue='0'));
        rColumn.childComponents.add(sList);
        //Numeric Selector
        Component.Apex.inputField numbers = new Component.Apex.inputField(type='number', required=false, value = '{!row.quote.Quantity__c}');
        numbers.expressions.rendered = '{!IF(row.question.question__c=="Numeric", "false","true")}';
        rColumn.childComponents.add(numbers);
        table.childComponents.add(rColumn);
        
        //Tip Column
        
        return table;    
    }

It won't compile, I get the following error:  value for <apex:inputField> is not a dynamic binding! 

Which is referring to the bolded line of code.  What's really frustrating is the exact same value is bound to the selection list, and it doesn't have any problems with that.  Is this a bug?  I see nothing wrong with my code.

Does anyone know how to left align the column headers of an apex:pageBlockTable?

 

Currently the fields are left aligned but the headers are centre aligned.

 

apex:pageBlockSection id="section04child" showHeader="true" title="Account specifications example3" columns="1">                
                <apex:pageBlockTable var="newFormChild" value="{!newFormChilds}" columns="7">              
                     <apex:column style="width:25px;"><apex:outputText style="color:#ccc;" value="{!TEXT(newFormChild.TF_Position__c+1)}"/></apex:column>
                		<apex:column >
                			<apex:facet name="header">FundSettle<br/>Participant<br/>Account Number </apex:facet>                			
                			<apex:inputField style="width:50px;" value="{!newFormChild.Account_number__c}" styleclass="{!IF(newFormChild.TF_Position__c==0, 'required', '')}" />
                		</apex:column>
                		<apex:column >
                		    <apex:facet name="header">Full Legal Name of<br/>the Account </apex:facet>                			                
                			<apex:inputField style="width:100px;" value="{!newFormChild.Full_Legal_Name__c}" styleclass="{!IF(newFormChild.TF_Position__c==0, 'required', '')}" />
                		</apex:column>
                		<apex:column >
                			<apex:facet name="header">Account<br/>Designation </apex:facet>               			
                			<apex:inputField style="width:100px;" value="{!newFormChild.Account_Designation__c}" styleclass="{!IF(newFormChild.TF_Position__c==0, 'required', '')}" />
                		</apex:column>
                		<apex:column >
                		 	<apex:facet name="header">Legal Address </apex:facet>                			
                			<apex:inputField style="width:175px;" value="{!newFormChild.Legal_Address__c}" styleclass="{!IF(newFormChild.TF_Position__c==0, 'required', '')}" />
                		</apex:column>
                		<apex:column >
                			<apex:facet name="header">Dividend Policy </apex:facet>                			
                			<apex:inputField style="width:125px;" value="{!newFormChild.Dividend_Policy__c}" styleclass="{!IF(newFormChild.TF_Position__c==0, 'required', '')}" />
                		</apex:column>
                		<apex:column >
                			<apex:facet name="header">Participant<br/>Account<br/>Reference </apex:facet>                 			
                			<apex:inputField style="width:100px;" value="{!newFormChild.Participant_Account_Reference__c}" styleclass="{!IF(newFormChild.TF_Position__c==0, 'required', '')}" />
                		</apex:column>
                </apex:pageBlockTable>
                    <script type="text/javascript">
							j$(document).ready(function () {
								changeNoneValue();
								addRequireFieldMarker();
							});
					</script>			
                </apex:pageBlockSection>     

 

Thanks

 

Chris