简体   繁体   English

PrimeFaces 3.5 Editor无法清除文本

[英]PrimeFaces 3.5 Editor can't clear text

I'm using JSF 2, Glassfish 3.1, PrimeFaces 3.5. 我正在使用JSF 2,Glassfish 3.1,PrimeFaces 3.5。 I copied demo from homepage which using PF 4.0. 我从使用PF 4.0的主页复制了演示。 I remove PF function to work my PF version. 我删除了PF功能以使用我的PF版本。

Here my code: 这是我的代码:

   <h:form id="form">

        <p:editor id="editor" value="#{editorBean.value}" width="600"/>

        <h:panelGrid columns="2" style="margin-top:10px">
            <p:commandButton id="submitButton" value="Submit" update="display" oncomplete="dlg.show()"
                             icon="ui-icon-disk" />
            <p:commandButton id="clearButton" type="button" value="Clear" onclick="editor.clear()"
                             icon="ui-icon-close" />
        </h:panelGrid>

        <p:dialog header="Content" widgetVar="dlg" showEffect="fade" hideEffect="fade" modal="true">
            <h:outputText id="display" value="#{editorBean.value}" escape="false" />
        </p:dialog>

    </h:form>

Submit button works well, but I can't clear editor text with Clear button. 提交按钮效果很好,但是我无法使用“清除”按钮清除编辑器文本。 Does PF 3.5 support clear method? PF 3.5是否支持清除方法? Hope anyone suggest me. 希望有人建议我。

You have not specified the widgetVar attribute. 您尚未指定widgetVar属性。 Because it picks up the widgetVar value for clearing the editor section, not the id in your case. 因为它选择了widgetVar值来清除编辑器部分,而不是您的情况下的id。

It should be. 它应该是。

<p:editor id="editor" value="#{editorBean.value}" widgetVar="editor" width="600" />

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

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