[英]Render p:selectManyCheckbox with 10 columns
I developed an interface JEE / JSF for some statistics. 我为一些统计数据开发了一个接口JEE / JSF。 I created checkbox to select references that the user wishes to display, but the trouble is that I use to generate the checkbox Arraylist based on data from my database.
我创建了复选框以选择用户希望显示的引用,但问题是我用来根据数据库中的数据生成复选框Arraylist。
And I can not position them as I want. 我不能按我的意愿定位它们。 I wish that after 10 checkbox, others generates directly to the line etc. ..
我希望在10个复选框后,其他人直接生成线等。
I have this result 我有这个结果
And i wish i could do this 我希望我能做到这一点
MTBFBEAN MTBFBEAN
private List<String> selectedReference = new ArrayList<String>();
private List<String> listReference = new ArrayList<String>();
private Boolean afficher = false; // Déclaration du bool pour le rendered de
// ma vue dans MTBF
@SuppressWarnings("deprecation")
public StatisticsBeanMTBF() {
this.beginDate = new Date(2001, 00, 01);
List<ProductConfModel> listtmp = this.moduleGlobal.getProductConfModels(2);
for (ProductConfModel pcm : listtmp) {
this.listReference.add(pcm.getReference());
}
}
public void mTBFByType() {
this.afficher = true;
this.listMTBF = new ArrayList<StatistiquesMTBF>();
List<StatistiquesMTBF> suspense = this.moduleGlobal.getMTBFByType(nbHeure, nbJour, NS, DAE, beginDate, endDate);
for (StatistiquesMTBF smtbf : suspense) {
for (String s : this.selectedReference) {
if (smtbf.getReference().equals(s)) {
this.listMTBF.add(smtbf);
}
JSF XHTML JSF XHTML
<h:outputText value="Date début :* " />
<p:calendar value="#{statisticsBeanMTBF.beginDate}"
navigator="true" required="true" />
<h:outputText value="Date fin:* " />
<p:calendar value="#{statisticsBeanMTBF.endDate}" navigator="true"
required="true" />
</h:panelGrid>
<h:panelGrid columns="1">
<h:outputText value="Selectionner votre référence : " />
<p:selectManyCheckbox id="grid" columns="5"
value="#{statisticsBeanMTBF.selectedReference}">
<f:selectItems value="#{statisticsBeanMTBF.listReference}" />
</p:selectManyCheckbox>
</h:panelGrid>
<p:separator />
If anyone can help me it would be nice. 如果有人能帮助我,那就太好了。
Thank you ! 谢谢 !
I get this outcome using: 我得到了这个结果:
<h:panelGroup layout="block" styleClass="selection">
<p:selectManyCheckbox layout="pageDirection" value="#{selection.selection}">
</h:panelGroup>
and setting each <tr>
: 并设置每个
<tr>
:
.selection tr {
float: left;
width: 33%;
}
In your case set it to 10% and outer container to width: 100%
. 在您的情况下,将其设置为10%,将外部容器设置为
width: 100%
。
It looks like that: 它看起来像这样:
You should add layout="grid"
to your p:selectManyCheckbox
according to this example . 您应该根据此示例将
layout="grid"
添加到p:selectManyCheckbox
。 Like this : 像这样 :
<p:selectManyCheckbox id="grid" layout="grid" columns="5" value="#{statisticsBeanMTBF.selectedReference}">
<f:selectItems value="#{statisticsBeanMTBF.listReference}" />
</p:selectManyCheckbox>
EDIT : 编辑:
A fast search in PrimeFaces documentations show that columns
was added in the version 4.0. PrimeFaces文档中的快速搜索显示版本4.0中添加了
columns
。 If you doesn't have this version or can't upgrade, you'll need to do it the old way with some CSS. 如果您没有此版本或无法升级,则需要使用一些CSS以旧方式执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.