在下面的代码中,当我选择datatable中的行时,我可以更新tabview。但是这里有一个小问题是我的一个选项卡中的编辑器在选择一行时是禁用的,而且如果第一次下载不工作则你第二次点击它会正常工作
<p:dataTable id="dataCall" var="call" value="#{calllist.mediumCallsModel}"
selection="#{calllist.selectedCall}" scrollRows="20" scrollHeight="350"
scrollWidth="150" liveScroll="true" selectionMode="single" paginator="true" rows="5"
widgetVar="callsTable" paginatorPosition="bottom" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,20,50">
<p:ajax event="rowSelect" listener="#{calllist.onRowSelect}" update=":MyListForm:showlist: :MyListForm:growl " />
<p:ajax event="rowUnselect" listener="#{calllist.onRowUnselect}" update=":MyListForm:growl"/>
<p:column headerText="Call ID">
<h:outputText value="#{call.callId}"/>
</p:column>
<p:column headerText="Created By">
<h:outputText value="#{call.createdBy}" />
</p:column>
<p:column headerText="Location">
<h:outputText value="#{call.location}" />
</p:column>
<p:column headerText="Status">
<h:outputText value="#{call.status}" />
</p:column>
<p:column headerText="Product">
<h:outputText value="#{call.product}" />
</p:column>
<p:column headerText="Module">
<h:outputText value="#{call.module}" />
</p:column>
<p:column headerText="Group Assigned">
<h:outputText value="#{call.groupAssigned}" />
</p:column>
<p:column headerText="Assigned to">
<h:outputText value="#{call.assignedTo}" />
</p:column>
<p:column headerText="Call creation">
<h:outputText value="#{call.callCreation}" />
</p:column>
</p:dataTable>
<h:panelGrid >
<p:tabView id="showlist" cache="true" style="font-size: 15px; height: 260px;width: 995px">
<p:tab id="tab1" title="Call Details">
<p:fieldset id="calldetails" style="background-color: lightgray; font-weight: bold;color: black;">
<table border="0" width="900px" align="left" style="font-size: 12px">
<tr>
<td width="100px"><h:outputText value="Status:"/></td>
<td width="80px"><p:selectOneMenu id="status" value="#{calllist.selectedCall.statusId}" style="width:114px; font-size: 12px">
<f:selectItem itemLabel="Select Status" itemValue="-1" />
<f:selectItems value="#{calllist.dyStatusList}" />
</p:selectOneMenu> </td>
</tr>
</table>
</p:fieldset>
</p:tab>
<p:tab title="Work log/Comments">
<table id="comment_table" width="900px" height="200px" border="0" style="font-size: 12px;">
<tr valign="top">
<td>
<div id="oldcomment" style="width:450px; height: 90px; background-color:lightgray;font-weight: bold;color: black;overflow: scroll;">
<ui:repeat value="#{calllist.oldComments}" var="item">
<table>
<tr>
<td><h:outputText value="User ID"/></td>
<td><h:outputText value="#{item.modifiedUserID}"/></td>
</tr>
</table>
<hr/>
</ui:repeat>
</div>
<div id="comment" style="width:450px; height: 90px; background-color:lightgray; font-weight: bold;color: black;" >
</div>
</td>
<td>
<p:editor id="editor" width="400" height="190" onchange="append_comment();" value="#{calllist.comments}"/>
</td>
</tr>
</table>
</p:tab>
<p:tab title="Attachments">
<h:form id="download_form">
<table id="download_list">
<tr>
<td>
<p:fileUpload id="upload" fileUploadListener="#{calllist.handleFileUpload}" mode="advanced" sizeLimit="100000" multiple="true" allowTypes="/(\.|\/)(gif|jpe?g|png|xls)$/" />
</td>
<td>
<p:selectOneListbox id="scroll" value="#{calllist.fileName}" style="width: 250px;">
<f:selectItem itemLabel="Select" itemValue="-1"/>
<f:selectItems value="#{calllist.attachment}"/>
</p:selectOneListbox>
</td>
</tr>
<tr>
<td></td>
<td align="center">
<p:commandButton id="downloadLink" value="Download" ajax="false" icon="ui-icon-arrowthick-1-s">
<p:fileDownload value="#{calllist.file}"/>
</p:commandButton>
</td>
</tr>
</table>
</h:form>
</p:tab>