簡體   English   中英

JSF2或primefaces p:selectManyCheckbox樣式與圖標

[英]JSF2 or primefaces p:selectManyCheckbox styling with icons

用圖標設計多個復選框的問題是什么?

<p:selectManyCheckbox value="#{Step4Bean.selectedItems}" id="tag-list" >
                        <f:selectItems value="#{Step4Bean.allItems}" var="item" itemLabel="#{item}" itemValue="#{item}"/>
                    </p:selectManyCheckbox>

我有6個項目的復選框,我必須有2行,每行3個項目,每個項目附近必須是一個圖標。 我們怎么解決這個問題? 這是一個輸出示例鏈接

http://jpeg.am/images/?i=5692b9db7ea1d060bc7c97bcc788d6b8.jpg

PF已經具有此組件的網格布局。

<h3>Grid Layout</h3>
<p:selectManyCheckbox id="grid" value="#{checkboxView.selectedCities}" layout="grid" columns="3">
    <f:selectItems value="#{checkboxView.cities}" var="city" itemLabel="#{city}" itemValue="#{city}" />
</p:selectManyCheckbox>

但最新的PF 5.2.3和5.3-SNAPSHOT具有自定義布局選項

<h3>Custom Layout (since v5.2.3)</h3>
<p:outputPanel id="customPanel" style="margin-bottom:20px">
    <p:selectManyCheckbox id="custom" value="#{checkboxView.selectedConsoles2}" layout="custom">
        <f:selectItem itemLabel="Xbox One" itemValue="Xbox One" />
        <f:selectItem itemLabel="PS4" itemValue="PS4" />
        <f:selectItem itemLabel="Wii U" itemValue="Wii U" />
    </p:selectManyCheckbox>

    <div class="ui-grid ui-grid-responsive">
        <div class="ui-grid-row">
            <div class="ui-grid-col-4">
                <p:checkbox id="opt1" for="custom" itemIndex="0" />
            </div>
            <div class="ui-grid-col-4">
                <p:checkbox id="opt2" for="custom" itemIndex="1" />
            </div>
            <div class="ui-grid-col-4">
                <p:checkbox id="opt3" for="custom" itemIndex="2" />
            </div>
        </div>
        <div class="ui-grid-row">
            <div class="ui-grid-col-4">
                <h:outputLabel for="opt1" value="Xbox One" />
            </div>
            <div class="ui-grid-col-4">
                <h:outputLabel for="opt2" value="PS4" />
            </div>
            <div class="ui-grid-col-4">
                <h:outputLabel for="opt3" value="Wii U" />
            </div>
        </div>
    </div>
</p:outputPanel>

不確定如何以及最新的functionaly可以與<f:selectItems/>一起使用,還是僅與多個<f:selectItem/> 我懷疑后者

另請參閱: - 請參閱http://www.primefaces.org/showcase/ui/input/manyCheckbox.xhtml

(來自PF展示的例子!)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM