Java Primefaces CommandButton 不会在 p:columns 标题方面触发 actionListener 方法

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18060670/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 22:07:38  来源:igfitidea点击:

Primefaces CommandButton does not fire actionListener method inside p:columns header facet

javajsfprimefaces

提问by anger

I would like to fire an actionListener from a p:commandButton inside a column header as follows:

我想从列标题内的 ap:commandButton 触发 actionListener ,如下所示:

<h:form id="foos">
    <p:messages id="mess" />

    <p:columns var="foo" value="#{fooBean.foos}">
        <f:facet name="header">#{foo.name} 
            <p:commandButton icon="ui-icon-trash" actionListener="#{fooBean.test()}" update=":foos" process="@this" />
        </f:facet>

        <h:outputText value="foobar" />

    </p:columns>
</h:form>

No matter what I try, the actionListener method never is fired. If I move the commandButton outside of the facet it works, so I assume there is something awry with the facet component in conjunction with the commandButton.

无论我尝试什么,actionListener 方法都不会被触发。如果我将 commandButton 移到它可以工作的构面之外,那么我认为构面组件与 commandButton 一起存在问题。

No messages are displayed so it appears that validation is not failing.

不会显示任何消息,因此看起来验证没有失败。

This is under Primefaces 3.5

这是在 Primefaces 3.5 下

回答by Srikanth B

if no ActionEvent parameter for your test method then use action

如果您的测试方法没有 ActionEvent 参数,则使用 action

 .....icon="ui-icon-trash" action="#{fooBean.test}" ...