📜  RichFaces Rich:DataGrid

📅  最后修改于: 2021-01-08 12:38:11             🧑  作者: Mango

RichFaces

它用于在网格中排列数据。我们可以从数据模型动态更新数据网格的数据。它还支持页眉,页脚和标题构面。

该组件的函数与JavaServer Faces < h:panelGrid >相似。

样式类和皮肤参数

下表包含DataGrid的样式类(选择器)和相应的外观参数。

Class Function Skin Parameters Mapped CSS properties
.rf-dg It is used to define styles for the grid. tableBackgroundColor
tableBorderWidth
background-color
border-left-width, border-top-width
.rf-dg-cap It is used to define styles for the grid caption. No skin parameters.
.rf-dg-r It is used to define styles for a grid row. No skin parameters.
.rf-dg-c It is used to define styles for a grid cell. tableBorderWidth border-bottom-width, border-right-width
.rf-dg-nd-c It is used to define styles for a node cell. tableBorderColor border-bottom-color, border-right-color
.rf-dg-th It is used to define styles for the grid header section. tableBorderColor border-bottom-color
.rf-dg-h It is used to define styles for a grid header. No skin parameters.
.rf-dg-h-f It is used to define styles for the first header. No skin parameters.
.rf-dg-h-r It is used to define styles for a header row. No skin parameters.
.rf-dg-h-c It is used to define styles for a header cell. tableBorderWidth border-bottom-width, border-right-width
.rf-dg-f It is used to define styles for a grid footer. No skin parameters.
.rf-dg-f-f It is used to define styles for the first footer. No skin parameters.
.rf-dg-f-c It is used to define styles for a footer cell. tableFooterBackgroundColor
tableBorderWidth
background-color
border-bottom-width, border-right-width

在下面的示例中,我们正在实现< rich:dataGrid >组件。本示例包含以下文件。

JSF文件

// data-grid.xhtml






Data Grid 




























托管豆

// StudentRecord.java

import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
@ManagedBean
@RequestScoped
public class StudentRecord {
String id;
String name;
String email;
String contactNumber;
List records;
public StudentRecord(){}
public StudentRecord(String id, String name, String email, String contactNumber) {
this.id = id;
this.name = name;
this.email = email;
this.contactNumber = contactNumber;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getContactNumber() {
return contactNumber;
}
public void setContactNumber(String contactNumber) {
this.contactNumber = contactNumber;
}
public List getRecords() {
records = new ArrayList<>();
records.add(new StudentRecord("101", "Raju", "raju@abc.com", "52534252"));
records.add(new StudentRecord("102", "Rama", "rama@abc.com", "52235252"));
records.add(new StudentRecord("103", "John", "john@abc.com", "52456252"));
records.add(new StudentRecord("104", "Peter", "peter@abc.com", "55625252"));
return records;
}
public void setRecords(List records) {
this.records = records;
}
public int getNumberOfRecords(){
return this.records.size();
}
}

输出: