You need to sign in to do that
Don't have an account?
sfdcsushil
Reloading Apex Component in the page
Hi,
We have an Apex Component(has one Controller attached to it) included in the Visualforce page. We want to get it refreshed when one User lookup is populated on the Visualforce Page. Please suggest if there is a way to accomplish this.
We had tried page reload. But that leads to Data being blanked out on the page. Is there any clean way to do it?
If the data is blanked out that sounds like you aren't saving the information on the page. If you refresh the page or any part of it, that will regenerate based on the information stored in the controller(s). Are you trying to pull back information from the related object tied to the lookup?
Hi Sushil,
you can try to palce your page component in outputpanel and then relaod the outputpanel, the component will be relaoded as outputpanel well be load.
Thanks
Hi Imran/Bob,
I want only component code to get refreshed. For that i want to call Apex method written in the Component controller. But i am not able to call that method from the page as the page has different controller.
Also Imran, what do you mean by reloading output panel? does it mean rerender it after ajax call?
Can you explain a little more about what you are trying to achieve.
I have one apex component(with some java script code) which refers to one Apex Controller.
I am refering above component in my page
<Apex:outputpanel>
<C:ComponentName someparameters>
<Apex:outputpanel>
When one field changes on the visualforce page, i want this Component to get refreshed. That is it should make one ajax call to the Component controller method.
But problem is in page i cannot refer to Component controller method. Also i cannot place ajax call in the component as it does not have Apex:page tags.
hope u understood my issue. Let me know if you need more information.
Hmm. Could you pass the some the page controller to the component as an attribute, and then have the component controller "register" itself with the page controller?
Thanks Bob for taking time in Helping me.
Can you Please let me know what do you mean by registering here?
And how do i call the Component controller this way and reload the component.
Can you tell us what it is you are trying to achieve from a functionalty perspective - this seems a somewhat torturous route to go and there might be other options.
@Sushil - Please let us know the solution, i m facing exactly the same issue. Thanks in advance
I needed to get specific components to re-render within a visualforce page. I found a solution by making the page controller aware of its component controllers. Once the visualforce page was aware of additional component controller methods, I was able to force the component to refresh itself. Here’s a walkthrough with a simplified sample of what I did. I’ll also list the source I used to create this solution. (You can use this in your dev org if you'd like to try it out, you'll just need to add some fields to the user record)