触发/模拟通过ClientListerner以编程方式单击事件

asp*_*rin 8 javascript jsf oracle-adf

到目前为止,我已按照文档设法获得了按钮的click事件.我现在正在努力的是以编程方式触发ADF组件的click事件.

源代码如下:

<af:showDetailItem id="pane1" text="Panel Label 1" disclosed="true">
    <af:commandButton text="commandButton 1" id="cb1">
        <af:clientListener method="showNext" type="action" />
    </af:commandButton>
</af:showDetailItem>

<af:showDetailItem id="pane2" text="Panel Label 2">
    <af:commandButton text="commandButton 2" id="cb2">
        <af:clientListener method="showNext" type="action" />
    </af:commandButton>
</af:showDetailItem>

<af:showDetailItem id="pane3" text="Panel Label 3">
    <af:commandButton text="commandButton 3" id="cb3">
        <af:clientListener method="showNext" type="action" />
    </af:commandButton>
</af:showDetailItem>
Run Code Online (Sandbox Code Playgroud)

使用Javascript

function showNext(evt){        
   var src = evt.getSource();
   var showDetailItemNode = src.getParent(); // targets the showDetailItem tag     
   /* how do I trigger the click event of this node */
}
Run Code Online (Sandbox Code Playgroud)

所以我基本上想要实现的是,当点击按钮#cb1时,我想模拟showDetailItem#pane1的click事件,依此类推......

小智 2

您可以循环浏览折叠组件的子组件以找出当前公开了哪个 showDetailItem。然后将其设置为已公开=假,并将下一个设置为真。