3

多くのチェックボックスをアイコンでスタイリングしたのは誰ですか?

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

私は 6 つの項目を持つチェック ボックスを持っています。各行に 3 つの項目を含む 2 つの行が必要です。各項目の近くには 1 つのアイコンが必要です。どうすればこれを解決できますか? ここに出力例のリンクがあります

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

4

1 に答える 1

1

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>

最新の機能を で使用できるかどうか、<f:selectItems/>または複数の でのみ使用できるかどうかはわかりません<f:selectItem/>。後者を疑う

参照: - http://www.primefaces.org/showcase/ui/input/manyCheckbox.xhtmlを参照

(PFショーケースの作例です!)

于 2015-05-20T20:48:01.107 に答える