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
james2000james2000 

Template apex:define content ignored in tables

I'm having problems trying to get content from an apex:define tag into my table (pageBlockTable or dataTable). Is this supported? I want to deliver template pages as part of a managed package that a customer can use and provide additional columns in a table.

When I view the page, it doesn't display the additional columns.

Template page:
Code:
<apex:page standardController="JCustom__c" title="JCustom {!JCustom__c.Name}" 
    extensions="jcustomcon">
  <apex:sectionHeader title="JCustom" subtitle="{!JCustom__c.Name}"/>
  <apex:form >
      <apex:pageBlock title="Custom" mode="edit">
          <apex:pageBlockButtons >
              <apex:commandButton action="{!save}" value="Save!"/>
          </apex:pageBlockButtons>
          <apex:pageBlockTable title="details" value="{!customs}" var="c">
              <apex:column headerValue="Field1">
                  <apex:inputField value="{!c.field1__c}"/>              
              </apex:column>
              <apex:insert name="customColumns"/>
          </apex:pageBlockTable>          
      </apex:pageBlock>
  </apex:form>
</apex:page>

Page using the template - note the tags between the composition and the define tags are needed for compilation:
Code:
<apex:page standardController="JCustom__c" title="JCustom {!JCustom__c.Name}" 
    extensions="jcustomcon">
  <apex:composition template="jc1">
  <apex:form>
  <apex:pageBlock>
  <apex:pageBlockTable value="{!customs}" var="c">
      <apex:define name="customColumns">
          <apex:column headerValue="Field2">
              <apex:inputField id="fld2" value="{!c.field2__c}"/>
          </apex:column>
          <apex:column headerValue="Field 3">
              <apex:inputField id="fld3" value="{!c.field3__c}"/>
          </apex:column>
      </apex:define>
  </apex:pageBlockTable>
  </apex:pageBlock>
  </apex:form>
  </apex:composition>
</apex:page>