Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 数据表内的分组单选按钮-Primefaces_Jsf_Primefaces - Fatal编程技术网

Jsf 数据表内的分组单选按钮-Primefaces

Jsf 数据表内的分组单选按钮-Primefaces,jsf,primefaces,Jsf,Primefaces,我想创建一个网页,使用datatable组件在primefaces中创建带有单选按钮的表,如下所示 我找到了一个解决方案来实现JSF中提到的自定义组件 但是这需要时间和大量代码。Primefaces为selectOneRadio提供了自定义布局。我使用selectOneRadio的自定义布局示例实现了该表,如下所示。在第一列中,包含单选按钮的宽度为零 <p:dataTable id ="employeeTable" rowIndexVar="rowId" var ="emp" value

我想创建一个网页,使用datatable组件在primefaces中创建带有单选按钮的表,如下所示

我找到了一个解决方案来实现JSF中提到的自定义组件


但是这需要时间和大量代码。

Primefaces为selectOneRadio提供了自定义布局。我使用selectOneRadio的自定义布局示例实现了该表,如下所示。在第一列中,包含单选按钮的宽度为零

<p:dataTable id ="employeeTable" rowIndexVar="rowId" var ="emp" value ="#{employeeList.employeeData}" widgetvar ="employeeTable" resizableColumns="true">

   <p:column headerText="" style="width:0px;">
     <p:selectOneRadio id="action" value="#{emp.status}" layout ="custom">
        <f:selectItem itemLabel="Yes" itemValue="Yes" />
        <f:selectItem itemLabel="No" itemValue="No" />
        <f:selectItem itemLabel="Amendment" itemValue="Amendment" />
        <f:selectItem itemLabel="KIV" itemValue="KIV" />
    </p:selectOneRadio>
    </p:column>

    <p:column headerText="Personnel No">
            <h:outputText value="#{emp.perNum}" />
    </p:column>
    <p:column headerText="Empl Name">
        <h:outputText value="#{emp.name}" />
    </p:column>                             
    <p:column headerText="Yes">
        <p:radioButton  for="action" itemIndex="0" />
    </p:column>
    <p:column headerText="No">
        <p:radioButton  for="action" itemIndex="1" />
    </p:column>
    <p:column headerText="Amendment">
        <p:radioButton for="action" itemIndex="2" />
    </p:column> 
    <p:column headerText="KIV">
        <p:radioButton  for="action" itemIndex="3" />
    </p:column> 
</datatable>

Primefaces为selectOneRadio提供自定义布局。我使用selectOneRadio的自定义布局示例实现了该表,如下所示。在第一列中,包含单选按钮的宽度为零

<p:dataTable id ="employeeTable" rowIndexVar="rowId" var ="emp" value ="#{employeeList.employeeData}" widgetvar ="employeeTable" resizableColumns="true">

   <p:column headerText="" style="width:0px;">
     <p:selectOneRadio id="action" value="#{emp.status}" layout ="custom">
        <f:selectItem itemLabel="Yes" itemValue="Yes" />
        <f:selectItem itemLabel="No" itemValue="No" />
        <f:selectItem itemLabel="Amendment" itemValue="Amendment" />
        <f:selectItem itemLabel="KIV" itemValue="KIV" />
    </p:selectOneRadio>
    </p:column>

    <p:column headerText="Personnel No">
            <h:outputText value="#{emp.perNum}" />
    </p:column>
    <p:column headerText="Empl Name">
        <h:outputText value="#{emp.name}" />
    </p:column>                             
    <p:column headerText="Yes">
        <p:radioButton  for="action" itemIndex="0" />
    </p:column>
    <p:column headerText="No">
        <p:radioButton  for="action" itemIndex="1" />
    </p:column>
    <p:column headerText="Amendment">
        <p:radioButton for="action" itemIndex="2" />
    </p:column> 
    <p:column headerText="KIV">
        <p:radioButton  for="action" itemIndex="3" />
    </p:column> 
</datatable>

使用
p:selectOneRadio
在数据表之外,将
layout
属性设置为“custom”。用
f:选择与通过“value”参数提供给数据表的数据相同的项

<p:selectOneRadio id="customRadio" 
                  value="#{beanMB.selectedItem}"
                  layout="custom">
    <f:selectItems value="#{beanMB.tableItems}"
                   var="item"
                   itemValue="#{item.radioValue}"
                   itemLabel="#{item.radioLabel}"/>
</p:selectOneRadio>

使用数据表外部的
p:selectOneRadio
,将
layout
属性设置为“custom”。用
f:选择与通过“value”参数提供给数据表的数据相同的项

<p:selectOneRadio id="customRadio" 
                  value="#{beanMB.selectedItem}"
                  layout="custom">
    <f:selectItems value="#{beanMB.tableItems}"
                   var="item"
                   itemValue="#{item.radioValue}"
                   itemLabel="#{item.radioLabel}"/>
</p:selectOneRadio>

此方法不适用于使用相同语法的我此方法不适用于使用相同语法的我