跳到主要内容

复杂表格

中国式复杂表格也是一种视图,Redash中文版支持完整的Markdown,借助Html5 的table即可实现复杂的中国式复杂表格。原理如下:

<table id="tab" cellpadding="1" cellspacing="1" border="1" style="background-color:{{"cookie": "colorstyle_back"}}">
<tr><th rowspan="2">序号</th>
<th rowspan="2">监测位置</th>
<th rowspan="2">供电通路</th>
<th rowspan="2">供电电压</th>
<th rowspan="2">负载电流</th>
<th rowspan="2">雷击次数</th>
<th rowspan="2">最近一次雷击时间</th>
<th colspan="2">后备保护空开状态</th>
<th rowspan="2">SPD损害数量</th>
<th colspan="2">输出空开状态</th></tr>
<tr><th>B级</th>
<th>C级</th>
<th>1路</th>
<th>2路</th></tr>
<tr><th rowspan="4">1</th></tr>
<tr><th>1</th>
<th>78</th>
<th>96</th>
<th>67</th>
<th>98</th>
<th>88</th>
<th>75</th>
<th>94</th>
<th>69</th>
<th>23 </th>
<th>33 </th></tr>
<tr><th colspan="2">提示建议</th>
<th colspan="2">智能防雷箱状态</th>
<th colspan="2">防雷箱型号</th>
<th colspan="3">防雷箱序列号</th>
<th colspan="2">防雷箱版本</th></tr>
<tr><th colspan="2">建议整机按规程检测</th>
<th colspan="2">在线</th>
<th colspan="2">2018041201-035PF</th>
<th colspan="3">2018041201-256</th>
<th colspan="2">V1.0.0</th></tr></table>

其中:style=”background-color:”是获取用户选择的样式背景色的取数函数,达到随用户选择该表表格背景的效果。前景和画布系统已内置,由于table的特殊性,需要设置表格体的背景。

当然也可以使用取数函数取后台任意结果集的数据填充表格。