You need to sign in to do that
Don't have an account?
ABak
Refreshing/Reloading a visualforce page
I have a Visualforce page where I am displaying some records in a pageBlockTable. I have the delete and edit links in a column .
My problem is that when we click delete it does execute the actionfunction in my controller and deletes the record but I want it to refresh the page as well. I dont know how to refrersh/reload the page through the controller.
I tried using javascript using window.location.reload() and calling it right after my delete funciton in the tag itself but its reloading the page before the delete takes place.
Heres the pageBlocktable code
<apex:pageBlockTable id="pbTable" var="row" value="{!maintenanceLineItems}" rendered="{!showMaintenanceTable}"> <apex:column headerValue="Action" width="50"> <a
href="javascript:EditMaintenanceLineItemEntries('{!row.maintenanceLineItem.Id}');" style="font-weight:bold">Edit</a> | <a href="javascript:if(window.confirm('Are you Sure?'))DeleteMaintenanceLineItemEnteries('{!row.maintenanceLineItem.Id}');" style="font-weight:bold">Del</a> </apex:column>
got it
PageReference p = new Apexpages.Standardcontroller(opp).view();
p.setRedirect(true);
return p;
here the opp would be the object linked to the standard controller.
All Answers
Add the reRender attribute to the actionFunction and assign it your pageBlockTable id
<apex:actionFunction reRender="pbTable" .......... />
Ignacio.
I tried to reset dataProvider to the list by deleting the deleted item from that variable (the one thats bound to the value prop of pageBlocktbale) and also set the reRender attribute on the actionfunciton but it still wont work.
Did you try to reset the var that is populating the table???? cause if it doesnt refresh on delete then you will show the same data as the first time.
Thanks thats nice as it does the partial page refresh but my problem is a little more than that. My visualforce page is an extension of the standard opportunity page which means I have a standard controller="Opportunity' and an extension controller as well.
I can certainly update my page view by partial page refresh as you mentioned but it also does some recalc based on the trigger thats fired which updates some standard opp fields and that wont be reflected by going down this way. Thats y i think reloading the whole page is the solution to this. Any ideas?
Why dont you use PageReference to redirect the whole page to itself?
You can find out about PageReference in this doc http://www.salesforce.com/us/developer/docs/apexcode/index.htm
Ignacio.
got it
PageReference p = new Apexpages.Standardcontroller(opp).view();
p.setRedirect(true);
return p;
here the opp would be the object linked to the standard controller.