繁体   English   中英

PrimeFaces p:具有readonlyInput =“ true”重置按钮的日历,不引起AJAX请求

[英]PrimeFaces p:calendar with readonlyInput=“true” reset button causing no AJAX request

由于没有用于<p:calendar> (readonlyInput =“ true”)的属性/选项将值重置为null,因此,目前最佳的解决方案是使用某些客户端JS来重置值,如下所示:

https://stackoverflow.com/a/12325640/396732

但是, 只要清除按钮控制了AJAX按钮 ,就不会提交新的日历值。

我试图处理“结束日期”按钮,例如:

                <p:calendar id="end-date"
                            widgetVar="myEntityEndDate"
                            value="#{myEntityManager.selectedEndDate}"
                            readonlyInput="true"
                            showOn="button">
                    <!-- update dependent "begin" calendar component: -->
                    <p:ajax event="dateSelect" process="@this" update="begin-date" />
                </p:calendar>
                <p:commandButton icon="ui-icon ui-icon-close"
                                 onclick="myEntityEndDate.setDate(null);"
                                 process="end-date"
                                 update="begin-date end-date" />

但是它不起作用...

问:

如何为AJAXed p:calendar组件实现重置按钮?

附录:

在这里提出了相同的问题: http : //forum.primefaces.org/viewtopic.php?f=3&t=27821 看来jQuery可能是“有罪的聚会”。 无论如何,应该解决/解决恕我直言。

如果你想重置将在服务器上得到体现,你应该使用actionp:commandButton

<p:commandButton icon="ui-icon ui-icon-close"
    action="#{myEntityManager.resetDate}"
    process="end-date"
    update="begin-date end-date" />


public void resetDate(){
    selectedEndDate = null;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM