2

I have added vf component twice to a page with different parameters.

When I check the view state in developer mode , I see there is only one controller instance for the 2 component added to a page. UI instances corresponding to those components updates the same controller instance.

Is this expected? or is there a way to have controller for each component added?

My UI needs separate controller for each component addition to the page?

1 Answer 1

2

Am having a Visualforce component to return the Date in current user's format. Am calling it like below

<c:RMA_LocaleDate date_Value="{!Today()}"></c:RMA_LocaleDate>
<c:RMA_LocaleDate date_Value="{!Today()+1}"></c:RMA_LocaleDate>

enter image description here

It shows today and tomorrow date. But when i check in view state it only shows tomorrow date.

It means the first visualforce component's controller instance is being overridden by the second.

When i check the debug logs, it has two instance of controller initialization, two constructor calls, two setters, two methods calls.

I assume this is the way Salesforce wanted it to work for the visualforce components referred multiple times in Visualforce page.

Hope it helps.

1
  • Thanks buddy. I had the same observation after little more digging.
    – Amit
    Commented Jun 29, 2015 at 4:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .