You need to sign in to do that
Don't have an account?
Javascript functions in re-rendered blocks
I've had some problems when including Javascript in re-rendered apex : outputPanels.
For instance, I had code like the following:
<apex:outputPanel id="myFrogDisplay"> // Displays info about the frogs to the user here with apex: repeat <script language="javascript" type="text/javascript"> function getMyEvents() { var myFrogs = '<table><tr><th>Day</th><th>Start Time</th><th>End Time</th><th>Description</th></tr>'; <apex:repeat var="fmf" value="{!formattedMyFrogs}"> myFrogs += '<tr><td><apex:outputText value="{!fmf.Name}"/></td>'; myFrogs += '<td><apex:outputText value="{!fmf.JumpLength}"/></td>'; myFrogs += '<td><apex:outputText value="{!fmf.JumpInterval}"/></td>'; myFrogs += '<td><apex:outputText value="{!fmf.Rank}"/></td></tr>'; </apex:repeat> myFrogs += '</table>'; return myFrogs; } </script> </apex:outputPanel>
This works just fine the first time it is generated, and I am able to use the Javascript function to send info to a a third party API.
However, when the outputPanel in which this resides is re-rerendered, two things happen:
(1) The code is modified correctly
(2) BUT the function when run returns only the original values from the function when it was first generated
Does anyone know why this is happening? Is there any way around this?
I am just wondering why this happens... Maybe the apex functions are not refreshed when rerendering..
try the following..
Do not rerender,just give a action support.. lets see if the javascript refreshes properly when the entire page loads again...
or else.. place the enitre output panel inside another output panel and rerender it... Coz i too faced a similar problem and this worked for me
Cheers.....
Do not rerender,just give a action support.
This worked for me using a Javascript function that builds an array based on a repeat. I was having trouble getting the function to build new data after a partial refersh (updating the javascript in the Viewstate, didn't necessarily change the information cached into the Javascript engine with the page on the initial load, if that makes sense)