I have an issue with <pe:codemirror>. I'm trying to have 3 editors in a modal dialog:
Code: Select all
<p:dialog id="jsDialog" header="Engine" widgetVar="jsDialogWidget" modal="true" >
<h:form id="jsForm" >
<p:tabView id="tab" orientation="top">
<p:tab title="Condition">
<pe:codeMirror widgetVar="conditionEditor" id="condition" mode="javascript" theme="eclipse" value="#{ruleView.selectedRule.condition}" lineNumbers="true" extraKeys="{ 'Ctrl-Space': function(cm) {CodeMirror.simpleHint(cm, CodeMirror.javascriptHint);}}" />
</p:tab>
<p:tab title="Operation">
<pe:codeMirror widgetVar="operationEditor" id="operation" mode="javascript" theme="eclipse" value="#{ruleView.selectedRule.operation}" lineNumbers="true" extraKeys="{ 'Ctrl-Space': function(cm) {CodeMirror.simpleHint(cm, CodeMirror.javascriptHint);}}" />
</p:tab>
<p:tab title="Post process" >
<pe:codeMirror widgetVar="postProcessEditor" id="postProcess" mode="javascript" theme="eclipse" value="#{ruleView.selectedRule.postProcess}" lineNumbers="true" extraKeys="{ 'Ctrl-Space': function(cm) {CodeMirror.simpleHint(cm, CodeMirror.javascriptHint);}}" />
</p:tab>
</p:tabView>
<div>
<p:commandButton id="submitJsForm" value="Modify" oncomplete="jsDialogWidget.hide();" />
<p:commandButton id="cancelJsForm" value="Cancel" oncomplete="jsDialogWidget.hide();" process="@none" update="jsForm" />
</div>
</h:form>
</p:dialog>
I tried to exectute widget.initilize() on the event onComplete() of the cancel button, but if the widget gets initialized twice the behavoir is not the expected. Anyone know what I should do in onComplete() in order to initialize only the widgets that needs it?? Is there any other solution to the problem?
Thanks a lot!