Unable to switch between VF page tabs after window reload (Salesforce)

Built on the SalesForce Developer Console, I have a page with 2 tabs – “Open Tab” and “Close Tab”.

1) Each tab has a set of records with a save button against each record.

2) Each record has a ‘Status’ picklist with values “Open” and “Close”.

3) “Open Tab” displays only those records with status as “Open”.

4) “Close Tab” displays only those records with status as “Close”.

5) On the “Open Tab” if i change the Status of a record to “Close” and save that record, it should move to the “Close Tab”. That is, the record should no longer be available in the “Open Tab” and it should automatically navigate to the “Close Tab”.

All’s well except point 5. Although the db update is happening correctly and the record is no longer available in the “Open Tab”, the automatic navigation to “Close Tab” is not happening. Please help.

Snippet from Visual Force Page:

function navigate() // switch from “Open Tab” to “Close Tab”
{RichFaces.switchTab(‘tstPg:form:TabPanelid’,’tstPg:form:Closeid’,’CLoseTab’);}


Snippet from controller class:

public PageReference save()
{
update ln; //ln is the obj instance that contains recs with status Open

    // window reload
    PageReference nextPage = new 
    pageReference('https://c.ap2.visual.force.com/apex/ABC?id='+Id);
    nextPage.setRedirect(true); 
    return nextPage;
}


Source: stackoverflow-javascript