Monday 13 February 2012

PrimeFaces: Many problems with p:editor...it is not displayed right!

How is <p:editor> rendered (initialized)?:

The PrimeFaces <p:editor widgetVar="myeditor"> in order it is rendered right it calls the javascript function myeditor.init().

Common problems:

When we place the editor in a Tab, Accordion, etc it may not be initialized right (why is init() not called?). Moreover when we submit a form with ajax the editor may also not be rendered right.

Solutions proposed (that have worked for me...):

Editor in a tab:

If the editor is in a tab then make the tab dynamic (<p:tabView dynamic="true">).

Another solution that may work for you is initializing the editor when you change the tab:
<p:ajax event="tabChange" oncomplete="myeditor.init()"></p:ajax>

References

1 comment: