I want to create a page like this with 2 components:
<apex:page standardController="Campaign">
<c:import campaign="{!campaign}" />
<c:message campaign="{!campaign}" />
</apex:page>
and for example in the component I want to render something like this:
<apex:component controller="ImportCampaignController" allowDML="true">
<apex:attribute name="campaign" description="This is the value of the campaign" type="Campaign"
assignTo="{!currentCampaign}" required="true"/>
<apex:pageBlock title="Sync status" >
<apex:form >
<apex:outputPanel rendered="{!currentCampaign.Sync__c == false}">
<apex:commandButton value="Import" action="{!importCampaignMember}" />
</apex:outputPanel>
</apex:form>
</apex:pageBlock></apex:component>
But obviously the visualforce complains about: SObject row was retrieved via SOQL without querying the requested field: Campaign.Sync__c
One solution might be to add the required fields on the visualforce page with some apex elements not rendered but it's not a clean solution. There is the addFields method on standardController but here is useless...