在我的Web应用程序中,我试图打开一个xhtml文件作为包含数据表的对话框,让用户选择行并在选择时关闭对话框。显示的数据表大小非常小。我无法调整数据表的大小。
显示以下代码,打开一个xhtml文件作为对话框。数据表的高度仅显示一行,无法调整大小。即使我调整表单大小,数据表大小也是相同的。
如何使数据表显示更多行,并且在调整大小形式时也调整数据表的大小?
我的输出看起来像这样。 output
谢谢你
<p:outputLabel value="Email Ref :" />
<p:commandButton id="test" value="ShowEmail" ajax="true" disabled="#{reminderBean.refType=='O'}" icon="ui-icon-extlink" actionListener="#{reminderBean.showEmails()}" >
<p:ajax event="dialogReturn" update="lblEmailRef lblEmailRef1 lblEmailRefDesc lblEmailRefDesc1" />
</p:commandButton>
My ReminderBean.java如下
@SessionScoped
@Named("reminderBean")
public class ReminderBean implements Serializable {
public void showEmails() {
System.out.println("In showEmails");
Map<String, Object> options = new HashMap<>();
options.put("modal", true);
options.put("resizable", true);
RequestContext.getCurrentInstance().openDialog("frmSelectEmail", options, null);
}
public void selectEmailFromDialog(Email mEmail) {
System.out.println("ReminderBean selectEmailFromDialog to " + mEmail.getEmailSubject());
selectedEmail = mEmail;
RequestContext.getCurrentInstance().closeDialog(selectedEmail);
}
....
}
我的frmSelectEmail.xhtml文件如下。
<ui:composition template="/WEB-INF/templates/layout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
>
<ui:param name="hideNorthPanel" value="true" />
<ui:param name="hideEastPanel" value="true" />
<ui:param name="hideWestPanel" value="true" />
<ui:param name="hideSouthPanel" value="true" />
<ui:define name="contentPanel">
<h:form id="frmSelectEmail">
<p:growl id="growl" showDetail="true"/>
<div style="height: 500px; width: 1200px; overflow: auto; ">
<p:dataTable
var="mEmail"
value="#{emailBean.emails}"
selectionMode="single"
rowKey="#{mEmail.id}"
scrollRows="15"
>
<p:column headerText="Received On" >
<h:outputText value="#{mEmail.emailReceivedOn}" />
</p:column>
<p:column headerText="From" >
<h:outputText value="#{mEmail.emailFrom}" />
</p:column>
<p:column headerText="Subject" >
<h:outputText value="#{mEmail.emailSubject}" />
</p:column>
<p:column headerText="Category" >
<h:outputText value="#{mEmail.category}" />
</p:column>
<p:column headerText="Select Email">
<p:commandButton icon="ui-icon-search" actionListener="#{reminderBean.selectEmailFromDialog(mEmail)}" value = "#{mEmail.reminderRef}" disabled="#{reminderBean.isThisEmailReferenceUsedInReminder(mEmail.id)}" />
</p:column>
</p:dataTable>
</div>
</h:form>
</ui:define>
<ui:define id="right" name="rightContent">
<h:form id="frmRecordDetails">
<p:panel id="pnl1">
</p:panel>
</h:form>
</ui:define>
</ui:composition>