本文概述
RichFaces提供了此组件, 用于在客户端订购列表中的项目。我们需要将value属性用于要排序的列表。
它还提供了由巫婆提供的上下按钮, 你可以更改列表中元素的顺序。
样式类和皮肤参数
下表包含orderingList的样式类和外观参数。
类(选择器) | Function | 皮肤参数 | 映射的CSS属性 |
---|---|---|---|
.rf-ord | 它用于为orderingList控件本身定义样式。 | 没有皮肤参数。 | |
.rf-ord-cntr | 它用于为orderingList控件的容器定义样式。 | 没有皮肤参数。 | |
.rf字CPTN | 它用于为orderingList控件的标题定义样式。 | headerTextColor headerSizeFont | 颜色字体大小 |
.rf-ord-lst | 它用于为orderingList控件的项目列表定义样式。 | 没有皮肤参数。 | |
.rf-ord-hdr | 用于定义项目列表标题的样式。 | headerBackgroundColor headerTextColor | 背景色 |
.rf-ord-opt | 它用于为orderingList控件中的选项定义样式。 | generalSizeFont | font-size |
.rf-ord-sel | 它用于为orderingList控件的选定选项定义样式。 | generalTextColor | border-color |
.rf-ord-dflt-lbl | 它用于为orderingList控件的默认标签定义样式。 | 没有皮肤参数。 | |
.rf-ord-btn | 它用于为orderingList控件的按钮定义样式。 | headerBackgroundColor | background-color |
.rf-ord-btn-dis | 用于禁用orderingList控件的按钮时定义样式。 | 没有皮肤参数。 | |
.rf-ord-lst-scrl | 它用于定义列表滚动条的样式。 | 没有皮肤参数。 |
例子
在下面的示例中, 我们正在实现<rich:orderingList>组件。本示例包含以下文件。
JSF文件
// orderingList.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<f:view>
<h:head>
<title>Ordering List Example</title>
</h:head>
<h:body>
<h:form>
<h:outputText value="Ordering List Example"/><br/><br/>
<rich:orderingList value="#{country.countryList()}" var="capital" itemValue="#{country}" itemLabel="#{country.countryName}">
</rich:orderingList>
</h:form>
</h:body>
</f:view>
</ui:composition>
托管豆
// Country.java
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
@ManagedBean
@RequestScoped
public class Country {
String CountryName;
public List<String> countryList() {
ArrayList<String> list = new ArrayList<>();
list.add("India");
list.add("Australia");
list.add("Germany");
list.add("Italy");
list.add("United States");
list.add("Russia");
return list;
}
public String getCountryName() {
return CountryName;
}
public void setCountryName(String CountryName) {
this.CountryName = CountryName;
}
}
输出
最初, 按钮被禁用。
选择列表项后, 所有禁用的按钮均已启用。
评论前必须登录!
注册