You need to sign in to do that
Don't have an account?

command button doesnn't rerender component
Hi,
I have a complex commandButton for voting idea. The function is everytime I click it, it votes for an idea in the controller, and in the front end I would like to popup a windows showing it is successful vote or any error. If it is success, then I hope the idea's likes point is refreshed partially and get increased.
The pop up windows is get rerendered and works well, but not the singleIdeaPanel which I would like to rerender, so the likes number is get increased.
Thanks in advance for the kind help
My code:
<apex:form >
<apex:outputPanel id="jspanelLV">
<script>
function onControllerReturn() {
alert('{!listViewMessage}')
}
</script>
</apex:outputPanel>
<apex:outputPanellayout="block"class="list_item"id="singleIdeaPanel">
<
apex:commandButtononclick="voteJS('{!JSENCODE(visualData.recordId.value)}');" reRender="jspanelLV, singleIdeaPanel"styleClass="{!IF(visualData.canVote,'icon icon_like small','icon icon_like small is-liked')}"rendered="{!$ObjectType.Idea.createable}"/>
{!visualData.likes.value}
</apex:outputPanel>
<
apex:actionstatusid="voteStatusLV"onstop="onControllerReturn();">
</apex:actionstatus>
<apex:actionFunctionaction="{!vote}"name="voteJS"reRender="singleIdeaPanel, jspanelLV"status="voteStatusLV">
<apex:paramname="IdeaId"assignTo="{!voteIdeaId}"value=""/>
</apex:actionFunction>
Anyways I guess you are aware about the fact rerender doesnt mean you are reloading the page it is just as good as re drawing the component.
Problem is happening because the underlying wrapper/object is not getting updated. You have to update the object with the action. Once that is updated the page will reflect the change
All Answers
Your code seems good doesnt seem to have a problem.
Well lets confirm the panel is reloading or not. Try adding an alert inside the panel. something like
So the alert will popup if it refereshes.
Let me know your finding after changing the code
Thank you for the reply.
I did the change, and actually it alerts!!! So it is just the likespoint doesn't get change before the rerender?! Because if I manually refresh the page, then it will get the increased likespoint. Hmmmm, I am confused.
Anyways I guess you are aware about the fact rerender doesnt mean you are reloading the page it is just as good as re drawing the component.
Problem is happening because the underlying wrapper/object is not getting updated. You have to update the object with the action. Once that is updated the page will reflect the change
Thanks for the inspiration. I got it. The problem is in controller, I didn't refresh the model data which used in the rerender component.