function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anuja Joshi 16Anuja Joshi 16 

On click OK button from popup window how to refresh the pageblock table in parent table and close popup window

Hello
        On click command button on parent window new popup window is opened.from popup window access csv file.when click on OK button from popup window i want to refresh pageblock table in parent table.please tell how to do it.your help is most appreciated.Thanks in advance.
code for popup window is given below:

<apex:page sidebar="false" showHeader="false" StandardController="Account" extensions="UploadCSVFileController">
    <apex:sectionHeader title="-{!Account.name}" subtitle="{!cp.Month_Year__c}"/>
        <apex:form >
            <script>
                function closeuploadpage()
                {
                    window.close();
                }
            </script>
            function closeandrefresh()
            {  
               
                window.opener.location.href='/apex/monthlydeductionspage?id={!account.id}';
                window.close();
            }
            <apex:pageBlock >
                <apex:pageBlocksection >
                    <apex:pageBlockSectionItem >              
                        <apex:inputFile value="{!CsvFileBody}" fileName="{!csvfile}"/>
                    </apex:pageBlockSectionItem>    
                </apex:pageBlocksection>
                <apex:actionRegion>
                    <apex:commandButton action="{!importcsvfile}" value="OK" oncomplete="closeandrefresh();"/>
                </apex:actionRegion>
                <apex:commandButton value="Cancel" onclick="closeuploadpage();"/>
                </apex:pageBlock>
        </apex:form>    
</apex:page>
Vasani ParthVasani Parth
Anuja,

Here is the sample code for it:
<apex:commandbutton action="{!save}" id="button" oncomplete="javascript:CloseAndRefresh()" value="Update"/>
and here is the java script function
<script language="JavaScript" type="text/javascript">
function CloseAndRefresh(){
window.opener.location.href="/{!$CurrentPage.parameters.id}";
      window.top.close();
}
</script>

Note : I would suggest to check this setting Setup-> Personal Setup  ->  My Personal Information -> Personal Information
Here check for "Development Mode". I have seen at various places and at community as well that if this check box is checked then popup would not close. Here, I would suggest to turn this checkbox off while you are testing this.