• Post Reply Bookmark Topic Watch Topic
  • New Topic

CodeMirror as a JSF 2.0 composite component doesn't render properly in tab or dialog

 
P Rrr
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just implemented CodeMirror (with some plugins) as a JSF 2.0 composite component (see code below). This component is working just fine as long as it's not placed inside some tab or dialog (anything that is not visible just after the page is loaded). When in tab or dialog, it seems like component is rendered, but content and line numbers are not visible until the component is clicked.

Before click:



After click:



Here's my JSF composite component template code:



Example of using composite component:



As I said, I cannot understand, why there's no content displayed (immediately) in my component (without clicking on it), placed in a (second - invisible at page load) tab while component, placed outside Primefaces' tabView is rendered properly (with content and line numbers).

Any help would be much appreciated. Thanks!
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on what you need, one of the existing extension tagsets such as RichFaces or PrimeFaces might already have a functional tag. They both wrap the CMEdit control.

The first thing I noticed was your expression:


It's dangerous to use the "$" jQuery shorthand in JSF, because EL interprets anything starting with "$" as a potential variable reference, and that could possibly make the entire function evaporate. Use the "jQuery" form instead.

Beyond that, tabs and dialogs operate by using the CSS show/hide attributes to make them visible (or not). Your CodeMirror control might be doing so as well with the net result that the 2 types of control interfere with each other.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!