Use seam to create a project, display a custom list output, define the table Title List headerlist and data list <list> datalist respectively, and then implement two display modes. One is the normal table mode, where a piece of data is displayed in one row. In this way, we can use RICH: datatable, and then use RICH: columns for custom iterations, note that index indicates the row index of each row of data. The Code is as follows:
XHTML code {
DP. Sh. toolbar. copytoclipboard (this); Return false;
} "Href =" http://writeblog.csdn.net/# ">
- <RICH: datatableValue = "# {orderresdetailhome. datalist}" Var = "list" rows = "10" style = "width: 100%;" rowkeyvar = "rownum">
- <RICH: column>
- <F: facetName = "Header">Serial number</F: facet>
- # {Rownum + 1}
- </Rich: column>
- <RICH: ColumnsValue = "# {orderresdetailhome. headerlist}" Var = "dataheader" Index = "idx">
- <F: facetName = "Header"># {Dataheader}</F: facet>
- # {List [idx + 2]}
- </Rich: columns>
- </Rich: datatable>
<RICH: datatable value = "# {orderresdetailhome. datalist} "Var =" list "rows =" 10 "style =" width: 100%; "rowkeyvar =" rownum "> <RICH: column> <F: facet name = "Header"> NO. </F: facet >#{ rownum + 1} </rich: column> <RICH: columns value = "# {orderresdetailhome. headerlist} "Var =" dataheader "Index =" idx "> <F: facet name =" Header ">#{ dataheader} </F: facet >#{ list [idx + 2]} </rich: columns> </rich: datatable>
In the Code # {list [idx + 2]}, adding 2 is because the data column starts with two columns and multiple outputs are used as other columns.
There is also a way to display data in a grid instead of displaying data in one row, in this case, the rich: Columns cannot be used for data iteration. You can consider using C: foreach, where varstatus = "status" can be defined ",
Obtain the row index of each row of data from # {status. Index}. The Code is as follows:
XHTML code {
DP. Sh. toolbar. copytoclipboard (this); Return false;
} "Href =" http://writeblog.csdn.net/# ">
- <RICH: DataGridVar = "list"
- Columns = "1"
- Elements = "10"
- Rowkeyvar = "rownum"
- Value = "# {orderresdetailhome. datalist }">
- <H: panelgridColumns = "1">
- <S: decorateTemplate = "/layout/display.xhtml">
- <UI: DefineName = "label">Serial number</UI: Define>
- # {Rownum + 1}
- </S: decorate>
- <C: foreachVar = 'datahead' items = '# {orderresdetailhome. headerlist}' varstatus = "status">
- <S: decorateTemplate = "/layout/display.xhtml">
- <UI: DefineName = "label"># {Dataheader}</UI: Define>
- # {List [status. index + 2]}
- </S: decorate>
- </C: foreach>
- </H: panelgrid>
- </Rich: DataGrid>
<RICH: DataGrid Var = "list" columns = "1" elements = "10" rowkeyvar = "rownum" value = "# {orderresdetailhome. datalist} ">
The latter is suitable for small screen devices.