4

How we can pass reRender attribute value using JavaScript? My apex component is:

<apex:actionFunction action="{!null}" name="notefordocument" reRender="dynamic">
               <apex:param name="fileid" value="" assignTo="{!fileid}"/>

        </apex:actionFunction>

In reRender attribute i have used dynamic but i want to set reRender attribute dynamically using javaScript.

2

I'm not sure you'll be able to do this as the parameter is processed by the server when the page is displayed to the user — even if you can it's likely to be hacky and at risk of breaking later down the road. Depending on your scenario it might be easier to leverage Visualforce remoting to move data back and forth and then to generate new output HTML accordingly.

If that's not an option, would be be disastrous to just skip the re-render and render the whole page again? Not perfect but a much simpler solution!

| improve this answer | |
1

There is no way to set rerender attribute dynamically.

Reason for this is, the portion which is going to be re-render is managed by plateform and calculates the elements which will be fetched when rendering will be done.

All value between rerender area are mapped by platform on the page. As your actionFunction called, an Ajax call happens which retrieve all the values mapped in back and replace it with old values with new values on page from controller.

If you have some idea of jsp servlet or .net you can understand how this happens. In these Ajax call return some required data and then you call javascript function to apply these changes on particular DOM. Salesforce do this by rerender.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.