Sar*_*ars 11 jsf multiple-columns primefaces selectmanycheckbox
我为一些统计数据开发了一个接口JEE/JSF.我创建了复选框以选择用户希望显示的引用,但问题是我用来根据数据库中的数据生成复选框Arraylist.
我不能按我的意愿定位它们.我希望在10个复选框后,其他人直接生成线等.
我有这个结果
我希望我能做到这一点
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);
}
Run Code Online (Sandbox Code Playgroud)
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 />
Run Code Online (Sandbox Code Playgroud)
如果有人能帮助我,那就太好了.
谢谢 !
Kub*_*uba 14
我得到了这个结果:
<h:panelGroup layout="block" styleClass="selection">
<p:selectManyCheckbox layout="pageDirection" value="#{selection.selection}">
</h:panelGroup>
Run Code Online (Sandbox Code Playgroud)
并设置每个<tr>
:
.selection tr {
float: left;
width: 33%;
}
Run Code Online (Sandbox Code Playgroud)
在您的情况下,将其设置为10%,将外部容器设置为width: 100%
.
它看起来像这样:
您应该根据此示例添加layout="grid"
到您的.像这样 :p:selectManyCheckbox
<p:selectManyCheckbox id="grid" layout="grid" columns="5" value="#{statisticsBeanMTBF.selectedReference}">
<f:selectItems value="#{statisticsBeanMTBF.listReference}" />
</p:selectManyCheckbox>
Run Code Online (Sandbox Code Playgroud)
编辑:
PrimeFaces文档中的快速搜索显示columns
已在4.0版中添加.如果您没有此版本或无法升级,则需要使用一些CSS以旧方式执行此操作.
归档时间: |
|
查看次数: |
11719 次 |
最近记录: |