Bsgrid关于表头合并和合计数量

Bsgrid合并表头、计算

(作者:邱名涛,撰写时间:2019年1月16日)
开发工具与关键技术:C# Asp.net + SQLserver

colspan 、rowspan这两个属性用于创建特殊的表格
colspan用来指定单元格横向跨越的列数:colspan就是合并列的,colspan=2的话就是合并两列。
rowspan用来指定单元格纵向跨越的行数:rowspan就是用来合并行的,比如rowspan=2就是合并两行。
rowspan通常使用在td和th标签中
row:行,col:列,span:跨度,跨距,范围

页面代码:

<div class="panel panel-primary" style="margin-top: 12px;">
                                        <div class="panel-heading">合并表头</div>
                                        <div class="panel-body">
                                            <table id="tb" border="1" style="width:100%">
                                                <thead>
                                                    <tr>
                                                        <th rowspan="2">No.</th>
                                                        <th rowspan="2">病员</th>
                                                        <th rowspan="2">初复诊</th>
                                                        <th colspan=2>药品收入</th>
                                                        <th colspan=10>医疗收入</th>
                                                        <th rowspan="2">合计</th>
                                                    </tr>
                                                    <tr>
                                                        <th hidden w_num="total_line">No.</th>
                                                        <th hidden w_index="Year"></th>
                                                        <th hidden w_index="Diana"></th>
                                                        <th w_index="Count">西药</th>
                                                        <th w_index="ContractNum">中药</th>
                                                        <th w_index="Risk">手术费</th>
                                                        <th w_index="This">调温费</th>
                                                        <th w_index="Credit">化验费</th>
                                                        <th w_index="Usable">治疗费</th>
                                                        <th w_index="This">血费</th>
                                                        <th w_index="This">床位费</th>
                                                        <th w_index="This">诊差费</th>
                                                        <th w_index="This">护理费</th>
                                                        <th w_index="This">检查费</th>
                                                        <th w_index="This">其他</th>
                                                        <th hidden w_index="Lixi"></th>
                                                    </tr>
                                                </thead>
                                                <tfoot>       //Gsgrid表格的计算方式
                                                    <tr>
                                                        <td class="aggcorlor"></td>
                                                        <td style="color:red;font-weight:bold" class="aggcorlor">合计 </td>
                                                        <td class="aggcorlor"></td>
                                                        <td class="aggcorlor" style="color:red;" w_agg="Sum,Count"></td>
                                                        <td class="aggcorlor" style="color:red;" w_agg="Sum,ContractNum"></td>
                                                        <td class="aggcorlor" style="color:red;" w_agg="Sum,Risk"></td>
                                                        <td class="aggcorlor" style="color:red;" w_agg="Sum,This"></td>
                                                        <td class="aggcorlor" style="color:red;" w_agg="Sum,Credit"></td>
                                                        <td class="aggcorlor" style="color:red;" w_agg="Sum,Usable"></td>
                                                        <td class="aggcorlor" style="color:red;" w_agg="Sum,Credit"></td>
                                                        <td class="aggcorlor" style="color:red;" w_agg="Sum,This"></td>
                                                        <td class="aggcorlor" style="color:red;" w_agg="Sum,This"></td>
                                                        <td class="aggcorlor" style="color:red;" w_agg="Sum,This"></td>
                                                        <td class="aggcorlor" style="color:red;" w_agg="Sum,This"></td>
                                                        <td class="aggcorlor" style="color:red;" w_agg="Sum,This"></td>
                                                        <td class="aggcorlor" style="color:red;" w_agg="Sum,Lixi"></td>
                                                    </tr>
                                                </tfoot>
                                            </table>
                                        </div>
                                    </div>

tfoot:定义和用法
标签定义表格的页脚(脚注或表注)。该标签用于组合 HTML 表格中的表注内容。
//JHShuLiang计算和/最大值都要调用上面的值获取数据库的值进行计算。
//sum:计算表格中的和;max:计算最大值

实现图例:
在这里插入图片描述

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值