1.自定义按钮JS:
var new_window = window.open('/apex/RelationUnitBuSetPage?rucId={!Relation_Unit__c.Id}');var loop = setInterval(function() {
if(new_window.closed) { clearInterval(loop); window.location.reload();} }, 1000);
2.Visualforce页面:
<apex:page standardController="Relation_Unit__c" extensions="RelationUnitBuSetPageController" readOnly="false" showHeader="false" sidebar="false"><apex:form id="form"><script>function closeWindow(){
if ({!refreshNumber} == 1) {window.close();}}</script><div align="center"><c:RoseMultiselectPicklist leftLabel="可选BU" leftOption="{!allBus}" rightLabel="已选BU" rightOption="{!selectedBu}" size="5" width="200px" recordId="{!recordId}" /></div><br/><div align="center">//这里使用oncomplete监听commandButton执行完成后的方法,需要添加reRender获取最新的refreshNumber标志位的值<apex:commandButton action="{!doSave}" value="保存修改" style="width: 80px" oncomplete="closeWindow()" reRender="form"/></div></apex:form>
</apex:page>
3.Controller设置标志位判断是否要刷新页面