+ Start a Discussion
NaishadhNaishadh 

A bug with repeat/component?

Hi,

 

I'm experiencing some unexpected behavior when trying to use the apex:repeat function with apex component.

 

Basically, I want to add component on the basis of data value. My Standalone component is working fine but when I try to put it inside apex:repeat tab rerender stop working.

 

here is my 'simplified' and easily testable page & controller

 

Any assistance greatly appreciated.

 

Component

 

<apex:component controller="customViewController">
<apex:form >
<apex:actionFunction name="changeView" action="{!updateViewList}" reRender="viewList" />
<apex:pageBlock >
<apex:outputpanel id="filterPanel" layout="block" style="background-color:#D9D9D9">
<apex:selectList size="1" multiselect="false" value="{!objectType}" onchange="changeView()">
<apex:selectOptions value="{!ObjectList}"></apex:selectOptions>
</apex:selectList>
<apex:selectList id="viewList" size="1" multiselect="false" value="{!objectView}">
<apex:selectOptions value="{!ObjectViewList}"></apex:selectOptions>
</apex:selectList>
<apex:commandButton value="Go!" action="{!reloadView}" rendered="true" reRender="dataPanel" />
</apex:outputpanel>
</apex:pageBlock>
</apex:form>
</apex:component>

 Component controller

 

public with sharing class customViewController {

public customViewController() {
objectType = 'Opportunity';

objectView = 'My Opportunity';
}

public PageReference reloadView() {
return null;
}


public List<SelectOption> getObjectViewList() {
List<SelectOption> objectViewList = new List<SelectOption>();

if(objectType.equals('Opportunity')) {
objectViewList.add(new Selectoption('My Opportunity','My Opportunity'));
objectViewList.add(new Selectoption('All Opportunity','All Opportunity'));
}

if(objectType.equals('Case')) {
objectViewList.add(new Selectoption('My Case','My Case'));
objectViewList.add(new Selectoption('All Case','All Case'));
}

return objectViewList;
}

public List<SelectOption> getObjectList() {
List<SelectOption> objectList = new List<SelectOption>();

objectList.add(new Selectoption('Opportunity','Opportunity'));
objectList.add(new Selectoption('Case','Case'));

return objectList;
}

public PageReference updateViewList() {
return null;
}

public String objectView {get; set;}

public String objectType { get; set;}
}

 

 VisualForce Page - With Repeat Tab - Component Rerender Not Working

 

<apex:page controller="repeatTestController" >

<apex:repeat value="{!DataList}" var="data">
<c:customviewcomptest></c:customviewcomptest>
</apex:repeat>
</apex:page>

 

 VisualForce Page - Without Repeat Tab - Component Rerender Working

 

<apex:page controller="repeatTestController" >
<c:customviewcomptest></c:customviewcomptest>
</apex:page>

 

 

 

 Controller

 

public with sharing class repeatTestController {
public List<String> getDataList() {
List<String> dataList = new List<String>();

dataList.add('1');

return dataList;

}
}

 

Message Edited by Naishadh on 11-04-2009 03:38 AM
NaishadhNaishadh

Reredner functionality is not working if I put component inside apex repeat.  Moderator any help?

Message Edited by Naishadh on 11-05-2009 04:44 AM
HarmpieHarmpie

Id's in the component will not be unique anymore insde the resulting document?