我需要一些桌面帮助。
我有一些示例数据:
array
0 =>
array
'ID' => string '1' (length=1)
0 => string '1' (length=1)
'Name' => string 'Jon' (length=3)
1 => string 'Jon' (length=3)
'SecondName' => string 'Dee' (length=3)
2 => string 'Dee' (length=3)
'Date' => string '3, 2011' (length=7)
3 => string '3, 2011' (length=7)
'TotalHours' => string '06:48' (length=5)
4 => string '06:48' (length=5)
'TotalFee' => string '124' (length=3)
5 => string '124' (length=3)
1 =>
array
'ID' => string '3' (length=1)
0 => string '3' (length=1)
'Name' => string 'Some ' (length=5)
1 => string 'Some ' (length=5)
'SecondName' => string 'Preson' (length=6)
2 => string 'Preson' (length=6)
'Date' => string '3, 2011' (length=7)
3 => string '3, 2011' (length=7)
'TotalHours' => string '32:06' (length=5)
4 => string '32:06' (length=5)
'TotalFee' => string '436' (length=3)
5 => string '436' (length=3)
2 =>
array
'ID' => string '3' (length=1)
0 => string '3' (length=1)
'Name' => string 'Some ' (length=5)
1 => string 'Some ' (length=5)
'SecondName' => string 'Preson' (length=6)
2 => string 'Preson' (length=6)
'Date' => string '4, 2011' (length=7)
3 => string '4, 2011' (length=7)
'TotalHours' => string '10:00' (length=5)
4 => string '10:00' (length=5)
'TotalFee' => string '1345' (length=4)
5 => string '1345' (length=4)
现在我正在尝试使用按人员分组的数据动态创建html表,因此名称/秒名称不会在每一行中重复。是否可以合并名称单元格?
/-----------------------------------------\
| | month 1 | hours | cash |
| Person 1 |------------------------------|
| | month 2 | hours | cash |
|-----------------------------------------|
| Person 2 | month 1 | hours | cash |
\-----------------------------------------/
...等 有可能吗?
答案 0 :(得分:1)
你要找的东西是rowspan
。
查看此链接:http://www.htmlcodetutorial.com/tables/index_famsupp_30.html
用法:
<TABLE BORDER=2 CELLPADDING=4>
<TR>
<TH ROWSPAN=3 BGCOLOR="#99CCFF">Production</TH>
<TD>Raha Mutisya</TD> <TD>1493</TD>
</TR>
<TR>
<TD>Shalom Buraka</TD> <TD>3829</TD>
</TR>
<TR>
<TD>Brandy Davis</TD> <TD>0283</TD>
</TR>
<TR>
<TH ROWSPAN=3 BGCOLOR="#99CCFF">Sales</TH>
<TD>Claire Horne</TD> <TD>4827</TD>
</TR>
<TR>
<TD>Bruce Eckel</TD> <TD>7246</TD>
</TR>
<TR>
<TD>Danny Zeman</TD> <TD>5689</TD>
</TR>
</TABLE>
</TABLE></html>
你需要正确地添加这个,但它给你基本的想法。
此外,您还需要按人名(或ID)对结果进行排序,并在运行结果集时跟踪它是否发生变化。这是最简单的解决方案。