Richfaces 4.2.2
rich:datatable内に、rich:popupパネルを表示するボタンを追加しました。ポップアップパネルにはa<rich:editor/>
と2<h:commandButton/>
が含まれます
データテーブルのボタンは、バッキングBeanのメソッドを呼び出して、編集する文字列を設定します。エディターはこの属性にマップされます。ボタンがバッキングBeanの文字列を設定していることがわかります。
<h:outputText/>
また、ポップアップパネルにを追加して、編集する文字列の値を表示します
問題は次のとおりです。
- エディターが表示されている場合、ソースボタンを数回押してソースモードに切り替えたり、ソースモードを解除したりするまで、編集パネルを使用することはできません。
- バッキングBean属性の値がエディターに表示されない
- バッキングBeanのメソッドにマップされたcommandButtonは、メソッドを呼び出さない
- outputTextは最初は正しい値を示しますが、データテーブルの異なる行が使用された場合、ポップアップパネルを後で使用しても変更されません。
私はポップアップとデータテーブルを同じフォームと別々のフォームで試し、ポップアップパネルの内側と外側の両方で別々のフォームを試しました
こちらがページです
<h:html xmlns="http://www.w3c.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
.
.
.
<h:form id="blogForm" prependId="false">
<rich:popupPanel id="mp" minHeight="600" minWidth="450" height="600" width="800" resizeable="true">
<f:facet name="header">
<h:outputText value="Modal Panel Title" />
</f:facet>
<rich:editor id="editor" toolbar="full" value="#{blogBean.currentEntry}" skin="office2003" viewMode="visual">
<f:param name="auto_focus" value="editor" />
</rich:editor>
<h:outputText escape="false" value=")))#{blogBean.currentEntry}(((" />
<h:commandButton value="Save" action="#{blogBean.save}">
<rich:componentControl target="mp" operation="hide" />
</h:commandButton>
<h:commandButton value="Cancel" >
<rich:componentControl target="mp" operation="hide" />
</h:commandButton>
</rich:popupPanel>
<a4j:commandButton value="Add new post" rendered="true" >
<rich:componentControl target="mp" operation="show" />
</a4j:commandButton>
<h:panelGrid columns="1">
<a4j:outputPanel id="panel" layout="block">
<rich:dataTable value="#{blogBean.entries}" columns="1" var="entry" rows="20" id="repeat" >
<rich:column width="800">
<rich:panel>
<f:facet name="header">
<a4j:commandButton value="Edit" rendered="true" oncomplete="#{rich:component('mp')}.show()">
<f:setPropertyActionListener value="#{entry}" target="#{blogBean.currentEntry}" />
</a4j:commandButton>
</f:facet>
<h:outputText escape="false" value="#{entry}" />
</rich:panel>
</rich:column>
</rich:dataTable>
</a4j:outputPanel>
</h:panelGrid>
</h:form>
</h:body>
</h:html>