I have a BIG problem using Datatable and Dialog together.
I need to click on a data line and display a dialog box that loads data from the selected data item.
The selection is fine, but the selected item is null as soon as the dialog box is displayed: /
Here is the code:
<h:form id="form">
<pou:dataTable widgetVar="conv" id="mex" var="conv" value="#{messagesBean.listaConversazioni}" paginator="true" rowKey="#{conv}" paginatorPosition="bottom"
selection="#{messagesBean.destinatario}" selectionMode="single" rows="15">
<pou:ajax event="rowSelect"
oncomplete="convDialog.show()" update=":form:display, :growl, :menuPanel" />
<pou:column>
<f:facet name="header">
<h:outputText value="Conversazioni"/>
</f:facet>
<h:outputText value="#{conv.username}"/>
</pou:column>
</pou:dataTable>
<pou:dialog id="convDialog" header="Conversazione" widgetVar="convDialog" onHide="conv.unselectAllRows()" position="center" modal="true" resizable="false" draggable="false"
showEffect="explode" hideEffect="explode" height="635" width="620">
<h:panelGrid id="display">
<pou:panel id="postForm">
<div align="center">
<pou:inputTextarea value="#{messagesBean.messaggio}" cols="50" autoResize="true" maxlength="255"/> <br/>
<pou:commandButton action="#{messagesBean.invia(messagesBean.destinatario)}" value="Invia" update="display, :growl"/>
</div>
</pou:panel>
<pou:panel>
<div class="conversazionePanel">
<pou:dataTable id="mexTable" var="mex" value="#{messagesBean.caricaConversazione(messagesBean.destinatario)}" rowStyleClass="postTable">
<pou:column style="border: none; background: rgba(0,0,0,0)">
<div id="messaggio_#{mex.idMessaggio}">
<pou:outputPanel rendered="#{mex.mittente eq loginBean.utente}">
<pou:panelGrid columns="2">
<h:outputText value="Io"/>
<div class="messaggioInviato">#{mex.testo}</div>
</pou:panelGrid>
</pou:outputPanel>
<pou:outputPanel rendered="#{mex.destinatario eq loginBean.utente}">
<pou:panelGrid columns="2">
<div class="messaggioRicevuto">#{mex.testo}</div>
<h:outputText value="#{mex.mittente.username}"/>
</pou:panelGrid>
</pou:outputPanel>
</div>
</pou:column>
</pou:dataTable>
</div>
</pou:panel>
</h:panelGrid>
</pou:dialog>
</h:form>
_
#{messagesBean.listaConversazioni} returns a list of users
_
#{conv} is user
_
#{messagesBean.destinatario}- The user I need to install. It takes a conv value when I click on a string, but it unexpectedly takes a null value.
It is strange to think that
<pou:dataTable id="mexTable" var="mex" value="#{messagesBean.caricaConversazione(messagesBean.destinatario)}"
but in the same dialog box
<h:outputText value="#{messagesBean.destinatario==null}">
outputs true: \
What is wrong with him?
source
share