Xpages:无法在对话框中进行部分刷新

时间:2015-10-21 13:47:13

标签: xpages xpages-extlib partial-page-refresh

Xpage包含一个包含两个字段的对话框。我只想在第一个字段中显示某个值的第二个字段。我试图使用部分刷新,但我无法让它工作。

我尝试将范围变量更改为不同的内容,但这并没有帮助。

看起来这应该很容易。

非常感谢任何帮助。

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex">
    <xp:this.beforePageLoad><![CDATA[#{javascript:applicationScope.status                   = ["1 Not Assigned","2 Assigned","3 Being Developed","4 Ready For User Test","5 Ready to Migrate to Production","6 Closed"];
applicationScope.assignedTo             = ["Not Assigned","Tanner Jessee","Vijay Somisetti"];    
applicationScope.assignedTo2            = ["Tanner Jessee","Vijay Somisetti"];
applicationScope.reason                 = ["User Training","System Availability","Configuration/Development Bug","Other"];   
sessionScope.newStatus = "None"
 }]]></xp:this.beforePageLoad>
    <xp:button id="button13" value="Promote"
        style="font-weight:bold;font-size:10pt">

            <xp:eventHandler event="onclick" submit="true"
                refreshMode="complete">
                <xp:this.action><![CDATA[#{javascript:viewScope.status = "2 Assigned"
viewScope.action = "P";
var d = getComponent('dialogAction');
d.show();}]]></xp:this.action>
            </xp:eventHandler>
    </xp:button>    
    <xp:br/>
    <xp:br/>
    <xp:panel id="pnlTicket" style="width:600px"><xe:dialog style="width:600px" id="dialogAction" refreshOnShow="true">
        <xp:div align="center">
            <xp:table style="margin-left:0.0px;margin-right:0.0px;width:560px;margin-top:5.0px;margin-bottom:5.0px" cellpadding="0" cellspacing="10">
                <xp:tr id="tblPromote">
                    <xp:this.rendered><![CDATA[#{javascript:viewScope.action == "P"}]]></xp:this.rendered>
                    <xp:td style="width:100px;float:left" align="left">
                        <xp:label value="Promote to..." id="label4"/>

                    </xp:td>
                    <xp:td style="width:350px;float:right" align="right">
                        <xp:comboBox id="newStatusP" style="width:200px" value="#{sessionScope.newStatus}">
                            <xp:selectItems>
                                <xp:this.value><![CDATA[#{javascript:var curSts:String = viewScope.status
var tmpArr = [];

if (curSts != "6 Complete")

{var stsArr:Array = applicationScope.status;
var nmb = stsArr.indexOf(curSts) + 1;

for (i = nmb; i < 6; i++) { 
    tmpArr.push(stsArr[i])
}
}
tmpArr}]]></xp:this.value>
                            </xp:selectItems>
                            <xp:eventHandler event="onchange"
                                submit="true" refreshMode="partial" refreshId="pnlTicket"/>

                        </xp:comboBox>
                    </xp:td>
                </xp:tr>
                <xp:tr id="tblReasonClosed">
                    <xp:td style="width:100px;float:left" align="left">
                        <xp:label value="Reason Closed..." id="label9"/>                    
                    </xp:td>
                    <xp:td style="width:350px;float:right" align="right">
                        <xp:comboBox id="comboBox6" style="width:200px;float:right" value="#{viewScope.assign}">
                            <xp:this.rendered><![CDATA[#{javascript:viewScope.newStatus == "6 Closed"}]]></xp:this.rendered>
                            <xp:selectItems id="selectItems5">
                                <xp:this.value><![CDATA[#{javascript:applicationScope.reason}]]></xp:this.value>
                            </xp:selectItems>
                        </xp:comboBox>
                    </xp:td>
                </xp:tr>    
            </xp:table>
        </xp:div>
        <xe:dialogButtonBar>
            <xp:button value="OK" id="button21">
                <xp:eventHandler event="onclick" submit="true"
                    refreshMode="partial" refreshId="pnlTicket">
                    <xp:this.script><![CDATA[XSP.closeDialog('#{id:dialogAction}')]]></xp:this.script>
                    <xp:this.action><![CDATA[#{javascript://Do Stuff}]]></xp:this.action>
                </xp:eventHandler>
            </xp:button>
            <xp:button value="Cancel" id="button20">
                <xp:eventHandler event="onclick" submit="false">
                    <xp:this.script><![CDATA[XSP.closeDialog('#{id:dialogAction}')]]></xp:this.script>
                </xp:eventHandler>
            </xp:button>
            <xp:text escape="true" id="computedField9" value="#{sessionScope.newStatus}"/>          
        </xe:dialogButtonBar>
    </xe:dialog>
  </xp:panel>

加法:

感谢Mike,您的建议。我遇到了一个非常interesting blog post by Mark Rodin.他解释了为什么这个开箱即用的原因,这实际上是对话框不在DOM中。他有一个我想尽快尝试的工作,但我找到了当前项目的解决方法。调用对话框时,我的底层文档处于读取模式,所以我只是将部分更改为完全刷新。完全矫枉过正?是。但它有效,我没有注意到任何速度问题。

我将来会尝试让它正常工作。

1 个答案:

答案 0 :(得分:0)

您的onchange事件正在部分刷新对话框 区域。如果刷新对话框中的区域,则应该没问题。