The rerender is not working. My data is getting updated but the pg block table is not getting refreshed. How to do that. Here is my code -
<script type="text/javascript">
function DoSomething(rcId,status){
try
{
var RCObj = new sforce.SObject("Child__c");
RCObj.id = rcId;
RCObj.Status__c = status;
sforce.connection.sessionId = '{!GETSESSIONID()}';
var result = sforce.connection.update([RCObj]);
if (result[0].getBoolean("success")) {
alert("Record Successfully Updated");
}
else {
alert("Failed to update RC " + result[0]);
}
}catch (e) {
alert(e);
}
}
</script>
<apex:form>
<apex:pageBlock id="pgBlock">
<apex:pageBlockTable value="{!Parent__c.Child__r}" var="item" id="mid" title="Table 1">
<apex:column value="{!item.Type__c}"/>
<apex:column value="{!item.Status__c}"/>
<apex:column headerValue="Action">
<apex:commandLink value="Approve" id="Approve" onClick="DoSomething('{!item.id}','Approved')" rerender="pgBlock"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
rerender
toreRender
.