有条件呈现的命令链接不会调用操作
我有一个
和一个
。该链接位于网格之外。页面加载时,我将 rendered="false"
保留在网格上。我在网格内还有另一个链接。因此,由于网格未渲染,因此该链接未渲染。单击网格外部的链接时,我设置 rendered="true"
,因此网格内部的链接也会被渲染。
现在,当我单击网格内的链接时,不会调用该操作。这是如何引起的以及如何解决?
<af:commandLink action="#{masterFileConfig.getMasterFileTypeConfig}" onclick="return requiredCheck();"
binding="#{masterFileConfig.commandLink1}"
id="commandLink1">
<af:objectImage source="/images/search.gif"
binding="#{masterFileConfig.objectImage1}"
id="objectImage1"/>
</af:commandLink>
<h:panelGrid columns="2" binding="#{masterFileConfig.panelGrid2}" rendered="#{masterFileConfig.showGrid}"
id="panelGrid2" width="100%" styleClass="greyTable">
<h:panelGrid columns="1" border="0"
id="panelGrid3" width="100%" style="text-align:right;">
<af:commandLink action="#{masterFileConfig.saveMasterFileTypeConfig}"
onclick="return handleBusinessRules();"
id="commandLink2">
<af:objectImage source="/images/save.gif" id="objectImage2"/>
</af:commandLink>
</h:panelGrid>
</h:panelGrid>
I have an <af:commandLink>
and a <h:panelGrid>
. The link is outside the grid. On page load I am keeping rendered="false"
on the grid. I also have another link inside the grid. So this link is not rendered since the grid is not rendered. On click of the link outside the grid I am setting rendered="true"
and thus the link inside the grid is also rendered.
Now, when I then click the link inside the grid, the action is not invoked. How is this caused and how can I solve it?
<af:commandLink action="#{masterFileConfig.getMasterFileTypeConfig}" onclick="return requiredCheck();"
binding="#{masterFileConfig.commandLink1}"
id="commandLink1">
<af:objectImage source="/images/search.gif"
binding="#{masterFileConfig.objectImage1}"
id="objectImage1"/>
</af:commandLink>
<h:panelGrid columns="2" binding="#{masterFileConfig.panelGrid2}" rendered="#{masterFileConfig.showGrid}"
id="panelGrid2" width="100%" styleClass="greyTable">
<h:panelGrid columns="1" border="0"
id="panelGrid3" width="100%" style="text-align:right;">
<af:commandLink action="#{masterFileConfig.saveMasterFileTypeConfig}"
onclick="return handleBusinessRules();"
id="commandLink2">
<af:objectImage source="/images/save.gif" id="objectImage2"/>
</af:commandLink>
</h:panelGrid>
</h:panelGrid>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试将链接的 clientComponent 属性设置为 true 吗?也许没有生成供 onClick 事件交互的客户端组件。
另外 - 您是否考虑过使用 af:commandImageLink 而不是两个组件?
Can you try and set the clientComponent property of your link to true? Maybe there is no client component generated for the onClick event to interact with.
Also - have you considered using the af:commandImageLink instead of two components?