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

Refresh the cell without refresh the visualforce page
Hi All,
How do I update a table ("<table>") without refresh the page?
for example:
I have a <td> and inside of this tag I have a Select options field, that when I change the value, fire a actions that update the value in account and deppending of the value the cell of this <td> must update with a background color.
The value update on the account normally but the color of the cell is changing after I reload the page.
But the problem is, if I reload the page, I lost all the data that are displaing in the page, forcing me to make a search again.
So, I want update the account, update the background cell and remain with the all current data.
is it possible?
Thanks
Rafael
How do I update a table ("<table>") without refresh the page?
for example:
I have a <td> and inside of this tag I have a Select options field, that when I change the value, fire a actions that update the value in account and deppending of the value the cell of this <td> must update with a background color.
The value update on the account normally but the color of the cell is changing after I reload the page.
But the problem is, if I reload the page, I lost all the data that are displaing in the page, forcing me to make a search again.
So, I want update the account, update the background cell and remain with the all current data.
is it possible?
Thanks
Rafael
After many many many many time expend on this issue I solve :)
Here is the code that I used and work:
I Add <apex:outputPanel id="page" > before the table tag and I add in the action function the actionSupport, that reRender the outputPanel.
<apex:actionFunction name="executar" action="{!Save}" reRender="null">
<apex:param name="id_contas" value="" assignTo="{!id_conta}"/>
<apex:param name="suporte_status" value="" assignTo="{!status_conta}"/>
<apex:actionSupport action="{!Save}" event="oncomplete" rerender="page"/>
</apex:actionFunction>
Pradeep, thanks for your help, for your time and for your patience.
Rafael
All Answers
Hope...It Helps
I used the reRender and this is reloading before the Apex code finish. So the data is not updated.
I gonna share my code here and you will see how it's working.
Here is my visualforce code:
<table>
<apex:form >
<apex:actionFunction name="executar" action="{!Save}" reRender="null">
<apex:param name="id_contas" value="" assignTo="{!id_conta}"/>
<apex:param name="suporte_status" value="" assignTo="{!status_conta}"/>
</apex:actionFunction>
<apex:repeat value="{!TodasContas}" var="conta">
<tr>
<td class="celula_cinza_claro"><apex:outputLink value="/{!conta.Id}" >{!conta.Name}</apex:outputLink></td>
<td style="{!if(conta.Suporte_Status__c == 'Fabricante','background-color:#1C1C1C; font-weight: bold; color:white !important',
if(conta.Suporte_Status__c == 'Concorrente','background-color:#CD0000; font-weight: bold',
if(conta.Suporte_Status__c == 'N/A','background-color:#FFD700; font-weight: bold',
if(conta.Suporte_Status__c == 'Oportunidade','background-color:#9ACD32; font-weight: bold', 'background-color:#EEE9E9; font-weight:bold'))))}" >
<apex:inputField value="{!conta.Suporte_Status__c}" id="suporte" onchange="gravar('{!conta.Id}', '{!$Component.suporte}');" styleClass="inputField_custom"></apex:inputField>
</td>
</tr>
</apex:repeat>
</apex:form>
</table>
So if you see, in the tag td, I have a conditional that will change de background of the cell, but it is working only after I reload the page.
And if I use the reRender as true or calling a method, the Apex controller code is not executed.
The list that I say before is a field of the account and I'm calling by:
<apex:inputField value="{!conta.Suporte_Status__c}" id="suporte" onchange="gravar('{!conta.Id}', '{!$Component.suporte}');" styleClass="inputField_custom"></apex:inputField>
here what is 'null' , here you should put the id of that particular block which shoud be reRendered...
from Database...
<apex:inputField value="{!conta.Suporte_Status__c}" id="suporte" onchange="gravar('{!conta.Id}', '{!$Component.suporte}'), executar()
After many many many many time expend on this issue I solve :)
Here is the code that I used and work:
I Add <apex:outputPanel id="page" > before the table tag and I add in the action function the actionSupport, that reRender the outputPanel.
<apex:actionFunction name="executar" action="{!Save}" reRender="null">
<apex:param name="id_contas" value="" assignTo="{!id_conta}"/>
<apex:param name="suporte_status" value="" assignTo="{!status_conta}"/>
<apex:actionSupport action="{!Save}" event="oncomplete" rerender="page"/>
</apex:actionFunction>
Pradeep, thanks for your help, for your time and for your patience.
Rafael