Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xpages 大纲中的Onclick事件在打开页面时执行_Xpages - Fatal编程技术网

Xpages 大纲中的Onclick事件在打开页面时执行

Xpages 大纲中的Onclick事件在打开页面时执行,xpages,Xpages,我有一个扩展库大纲控件。大纲中有两个基本节点。每个节点上的onclick事件都应该运行一些代码。问题是这两个onClick事件都是在页面打开时执行的,但在实际单击节点时似乎没有执行 你知道会出什么问题吗 <xe:outline id="outline1"> <xe:this.treeNodes> <xe:basicLeafNode label="Set Value 1"> <xe:this.onClick>

我有一个扩展库大纲控件。大纲中有两个基本节点。每个节点上的onclick事件都应该运行一些代码。问题是这两个onClick事件都是在页面打开时执行的,但在实际单击节点时似乎没有执行

你知道会出什么问题吗

<xe:outline id="outline1">

<xe:this.treeNodes>
        <xe:basicLeafNode label="Set Value 1">
            <xe:this.onClick><![CDATA[#{javascript:getComponent("inputText1").value = "123";}]]></xe:this.onClick>
        </xe:basicLeafNode>
        <xe:basicLeafNode label="Set Value2">
            <xe:this.onClick><![CDATA[#{javascript:getComponent("inputText2").value = "456";}]]></xe:this.onClick>
        </xe:basicLeafNode>
    </xe:this.treeNodes>

</xe:outline>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:br></xp:br>Value 1:&#160;
<xp:inputText id="inputText1"></xp:inputText>
<xp:br></xp:br>Value 2:&#160;
<xp:inputText id="inputText2"></xp:inputText>

值1: ;
值2: ;

basicLeafNode的onClick事件仅适用于客户端JS。您需要使用每个basicLeafNode的submitValue属性,然后将SSJS添加到outline控件的onItemClick事件中。然后,您可以使用context.getSubmittedValue()检查单击的节点,然后采取相应的行动:

<xe:outline id="outline1">
    <xe:this.treeNodes>
        <xe:basicLeafNode label="Set Value 1" submitValue="1"></xe:basicLeafNode>
        <xe:basicLeafNode label="Set Value2" submitValue="2"></xe:basicLeafNode>
    </xe:this.treeNodes>
    <xe:this.onItemClick><![CDATA[#{javascript:
        if (context.getSubmittedValue() == "1") {
            getComponent("inputText1").value = "123"
        } else if (context.getSubmittedValue() == "1") {
            getComponent("inputText2").value = "456"
        }
    }]]></xe:this.onItemClick>
</xe:outline>

从XPages扩展库手册(第240页)中:

onClick属性允许开发人员执行 客户端JavaScript代码和submit-Value属性允许 开发人员指定传递回服务器的值。这 值是从该控件的onItemClick事件访问的 包含树节点


basicLeafNode的onClick事件仅适用于客户端JS。您需要使用每个basicLeafNode的submitValue属性,然后将SSJS添加到outline控件的onItemClick事件中。然后,您可以使用context.getSubmittedValue()检查单击的节点,然后采取相应的行动:

<xe:outline id="outline1">
    <xe:this.treeNodes>
        <xe:basicLeafNode label="Set Value 1" submitValue="1"></xe:basicLeafNode>
        <xe:basicLeafNode label="Set Value2" submitValue="2"></xe:basicLeafNode>
    </xe:this.treeNodes>
    <xe:this.onItemClick><![CDATA[#{javascript:
        if (context.getSubmittedValue() == "1") {
            getComponent("inputText1").value = "123"
        } else if (context.getSubmittedValue() == "1") {
            getComponent("inputText2").value = "456"
        }
    }]]></xe:this.onItemClick>
</xe:outline>

从XPages扩展库手册(第240页)中:

onClick属性允许开发人员执行 客户端JavaScript代码和submit-Value属性允许 开发人员指定传递回服务器的值。这 值是从该控件的onItemClick事件访问的 包含树节点


根据,您的示例代码在与移动控件一起使用时不起作用。是否存在已知的限制?您好,Vitor,当您单击大纲时,您是否可以验证是否生成了HTTP POST?不是,只是生成了HTTP GET。根据,您的示例代码在与移动控件一起使用时不起作用。有一个已知的限制吗?嗨,维托,当你点击大纲的时候,你能确认一个HTTP POST被生成了吗?没有,只有一个HTTP GET被生成。