I have created a datatable
& rowExpansion
inside this, rowWxpansion
does not display one of the column values from same p:dataTable
.
I need to take a particular commentId
, which is clicked for expansion, from dataTable
to panel grid of rowExpansion
& save the commentId
and input of textArea
in the DB, but commentId
is 0 in panelGrid
when row is expanded. If data is displayed in dataTable
then why is it not coming in panelGrid
.
Below is the code
<h:form id="commentList">
<p:dataTable id="commentTable" paginator="true" rows="10" var="comment" value="#{commentAction.list(uID)}" class="table table-striped table-bordered table-hover commentTable" widgetVar="commentListTable">
<p:column>
<p:rowToggler/>
</p:column>
<p:column filterBy="#{comment.commentId}" footerText="" headerText="Comment Id" filterMatchMode="contains" sortBy="#{comment.commentId}">
<h:outputText value="#{comment.commentId}" id="commentId"/>
</p:column>
<p:column filterBy="#{comment.selectedText}" headerText="Selected Text" sortBy="#{comment.selectedText}">
<h:outputText value="#{comment.selectedText}" id="selectedText"/>
</p:column>
<p:column filterBy="#{comment.commentText}" headerText="Comment" sortBy="#{comment.commentText}">
<h:outputText value="#{comment.commentText}" id="commentText" escape="false"/>
</p:column>
<p:column filterBy="" headerText="Comment From" sortBy="">
<h:outputText value="" id="commentFrom"/>
</p:column>
<p:column filterBy="#{comment.insertedOn}" headerText="Date/Time" sortBy="#{comment.insertedOn}">
<h:outputText value="#{comment.insertedOn}" id="insertedOn"/>
</p:column>
<p:column filterBy="#{comment.commentStatus}" headerText="Comment Status" sortBy="#{comment.commentStatus}">
<h:inputHidden value="#comment.commentId" id="commId"/>
<h:selectOneMenu value="#{comment.commentStatus}" id="commentStatus" class="commentSelectBox">
<f:selectItem itemLabel="#{comment.commentStatus}" itemValue="#{comment.commentStatus}" itemDisabled="true"/>
<f:selectItem itemValue="Open" itemLabel="Open"/>
<f:selectItem itemValue="Close" itemLabel="Close"/>
<f:selectItem itemValue="Cancel" itemLabel="Cancel"/>
<f:ajax event="change" listener="#{commentAction.updateCommentStatus}" execute="commId commentStatus"/>
</h:selectOneMenu>
</p:column>
<p:rowExpansion>
<h:panelGrid id="display" columns="1" cellpadding="4" style="width:100%" styleClass="replyBox" >
<h:form class="commentDescriptionDiv commentDesing">
<h:outputText value="#{comment.commentId}"/>
<h:inputTextarea value="#{commentAction.replyText}"/>
<h:commandLink value="Reply" action="#{commentAction.saveReply(commentId)}"/>
</h:form>
</h:panelGrid>
</p:rowExpansion>
</p:dataTable>