【发布时间】:2013-08-01 06:31:12
【问题描述】:
Primefaces 3.5
当我在p:panel 中设置p:dataTable 时,面板无法显示兼容宽度。
问题是table width 大于panel width,如下图所示。
如果我删除p:layout,就可以了。
我想得到比table width 大的panel with。用jQuery能解决吗?
panel.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<p:layout fullPage="true">
<p:layoutUnit position="west" size="260">
left
</p:layoutUnit>
<p:layoutUnit position="north" size="50">
header
</p:layoutUnit>
<p:layoutUnit position="center" resizable="true">
<h:form enctype="multipart/form-data">
<p:panel header="Vehicle Information" id="vehicleInfoWizardPanel">
<p:dataTable id="vehicleTable">
<p:column headerText="Sr. No">
</p:column>
<p:column headerText="Registration No">
</p:column>
<p:column headerText="Model">
</p:column>
<p:column headerText="Engine No">
</p:column>
<p:column headerText="Chassis No">
</p:column>
<p:column headerText="Cubic Capacity">
</p:column>
<p:column headerText="Seating">
</p:column>
<p:column headerText="Weight (Ton)">
</p:column>
<p:column headerText="Sum Insured">
</p:column>
<p:column headerText="Product Type">
</p:column>
<p:column headerText="Add On">
</p:column>
<p:column headerText="Period (Month)">
</p:column>
<p:column headerText="Manufacture">
</p:column>
<p:column headerText="Type Of Body">
</p:column>
</p:dataTable>
</p:panel>
</h:form>
</p:layoutUnit>
<p:layoutUnit position="east" size="260">
Right
</p:layoutUnit>
<p:layoutUnit position="south" size="40">
footer
</p:layoutUnit>
</p:layout>
</h:body>
</html>
更新
即使我通过 jquery 获取面板宽度,它总是返回 null。
var width = $("#vehicleInfoWizardPanel").width();
alert(width);
但是,我得到了惊人的观点。如果我删除h:form,不使用jquery 一切正常。
【问题讨论】:
-
为什么不简单地使用
p:panel的style属性并设置width(例如style = "width: 500px")。根据需要更改大小。 -
@Andy,修复宽度?我想要 100% 的宽度,但它将与 p:layout 内容兼容
-
这只是一个建议,100% 宽度不起作用?
-
我喜欢,不行。
标签: jquery jsf jsf-2 primefaces