+ Start a Discussion
TehNrdTehNrd 

Attributes in a component, in a pageBlockTable, loose value on rerender (bug)

I am pretty sure this one is a bug but I have a very simple component that has one attribute which is a string and passes the value to a style attribute in an outputpanel in the component. If this is in a pageBlockTable and you perform a rerender on the component this value will be lost.

Below is the code to reproduce:

Page:

<apex:page controller="componentIssues">
<apex:form >

Component in a pageBlockTable:<br/>
<apex:pageBlock >
<apex:pageBlockTable value="{!opps}" var="o">
<apex:column value="{!o.Name}"/>
<apex:column >
<c:componentStyle width="400px" />
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>


Component by itself:<br/><br/>
<c:componentStyle width="400px"/>

</apex:form>
</apex:page>

Componenet:

<apex:component >
<apex:attribute name="width" type="String" assignTo="{!width}"description="The width the outputPanel defined as '300px' or '100%'."/>

<apex:commandButton value="Rerender" reRender="all"/>

<apex:outputPanel id="all">
width should be: {!width}
<apex:outputPanel id="myDiv" layout="block" style="width: {!width};">
<apex:outputPanel layout="block" style="background-color: #F7B64B;">Hi.</apex:outputPanel>
</apex:outputPanel>
</apex:outputPanel>
</apex:component>

Simple controller for the page:

public class componentIssues {

List<Opportunity> opps;

public List<Opportunity> getOpps() {
if(opps == null){
opps = [select Name from Opportunity limit 1];
}
return opps;
}
}

If the component is not in a data table it works fine.  Any workarounds or solutions? I think this is a bug but if not I will edit the subject.

Thanks,
Jason 

Message Edited by TehNrd on 10-12-2009 08:58 AM
TehNrdTehNrd
Support Case #: 02998713
patrospatros

TehNrd,

 

Have you made any headway on this issue? I think I've run into the same thing - I have a nested component that is receiving ab SFID as an attribute to generate a list of data. When I try to setup paging on the component, my component zones out and forgets the value of the SFID attribute being passed. Debugging shows that the value is null of subsequent requests.

 

Oddly, the component works fine when it's not nested. Either I'm having the same problem, or my understanding of using rerender in a nested component is wrong... 

TehNrdTehNrd

This is the most recent reply from sf support on 10/27/2009:

 

Engineering is working on a fix... ------- will notify you when it is fixed and can work with engineering if you have further questions.