RepeatControl按钮CSJS不起作用

时间:2018-08-02 05:31:47

标签: xpages

打开时,没有结果。

这是我的xpage的代码重复控制:

<xp:repeat
    id="repeat2"
    rows="5"
    var="viewEntryEscalation">
    <xp:this.value><![CDATA[#{javascript:
        var viewEscalation : NotesView = database.getView("(subEscalation)");
        var viewEntryCollectionEscalation : NotesViewEntryCollection = viewEscalation.getAllEntriesByKey(currentDocument.getDocument().getParentDocumentUNID());
        return viewEntryCollectionEscalation}]]>
    </xp:this.value>
    <xp:button
        style="margin-right:10.0px"
        id="Button"
        disableTheme="true">
        <xp:this.value><![CDATA[#{javascript:
            translateString('Level')+" "+ viewEntryEscalation.getDocument().getItemValueString("Level") 
        }]]></xp:this.value>
        <xp:this.disabled><![CDATA[#{javascript:
            viewEntryEscalation.getDocument().getItemValueString("Level")==currentDocument.getItemValueString("Level")
        }]]></xp:this.disabled>
        <xp:eventHandler
            event="onclick"
            submit="false"
            id="eventHandler14">
            <xp:this.script><![CDATA[
                XSP.openDialog('#{id:dialogReason}', '',  { "FieldName" : "Level" , "DataValue" : viewEntryEscalation.getDocument().getItemValueString("Level") });
            ]]></xp:this.script>
        </xp:eventHandler>
    </xp:button>
</xp:repeat>

如何在重复控制中运行此CSJS按钮代码?

1 个答案:

答案 0 :(得分:2)

XSP.openDialog(...在客户端执行,但是您的第三个参数肯定包含服务器端代码。

在使用#{javascript: ...}将代码发送给客户端之前,先执行服务器端代码:

  XSP.openDialog('#{id:dialogReason}', 
                 '',  
                 { "FieldName" : "Level" , 
                   "DataValue" :
                       '#{javascript: viewEntryEscalation.getDocument().getItemValueString("Level")}'
                 });