当前位置:网站首页>Vxe table/grid cell grouping and merging
Vxe table/grid cell grouping and merging
2022-07-28 02:06:00 【Teln_ Xiao Kai】
Columns to merge
['htbm','htmc','hetd','hetdws','yjs']
General merger , Without logic , Directly merge the columns with the same name corresponding to their respective columns , As shown below , Not contract data , Have the same value , Directly merged

Combined with logical differentiation , It will judge the consistency of the previous fields in turn before merging the following fields , The renderings are as follows :

Realize the idea :
1、 Configure the fields to be merged
:mergeFields="['htbm','htmc','hetd','hetdws','yjs']"2、 Realization vxe table perhaps grid How to merge
:span-method="mergeRowMethod"3、 Specifically mergeRowMethod The implementation method is as follows
// General row merge function ( Merge the same multiple columns of data into one row )
mergeRowMethod({ row, _rowIndex, column, visibleData }) {
const fields = this.mergeFields;
if (fields.length == 0) {
return;
}
const cellValue = row[column.property];
if (
cellValue != undefined &&
cellValue != null &&
fields.includes(column.property)
) {
const prevRow = visibleData[_rowIndex - 1];
let nextRow = visibleData[_rowIndex + 1];
//if (prevRow && prevRow[column.property] === cellValue) {
if (prevRow && this.checkMergeFields(row, prevRow, column.property)) {
return { rowspan: 0, colspan: 0 };
} else {
let countRowspan = 1;
//while (nextRow && nextRow[column.property] === cellValue) {
while (nextRow && this.checkMergeFields(row, nextRow, column.property)) {
nextRow = visibleData[++countRowspan + _rowIndex];
}
if (countRowspan > 1) {
return { rowspan: countRowspan, colspan: 1 };
}
}
}
},
// Cycle through the previous columns , If the values are different, they will not be merged
checkMergeFields(row, nextRow, property) {
var ret = true;
for (var i = 0; i < this.mergeFields.length; i++) {
var field = this.mergeFields[i];
if (nextRow[field] != row[field]) {
ret = false;
break;
}
if (field == property) {
break;
}
}
return ret;
},边栏推荐
- In the era of great changes in material enterprises, SRM supplier procurement system helps enterprises build a digital benchmark for property procurement
- 【面试:并发篇28:volatile】有序性
- GBase 8c 服务器信号函数
- The petrochemical industry is facing the tide of rising prices, and the digital dealer distribution system platform enables dealers and stores
- Software testing interview question: what types of software testing are you familiar with?
- Codeforces Round #807 (Div. 2) A-C题解
- 软件测试面试题:你认为做好测试用例设计工作的关键是什么?
- Custom type: structure, enumeration, union
- Leetcode high frequency question 128. the longest continuous sequence, which is often tested in interviews with Internet companies
- uniapp 总结篇 (小程序)
猜你喜欢

Enterprise operation and maintenance practice - using aliyun container image service to pull and build images of overseas GCR and quay warehouses

Vxe Table/Grid 单元格分组合并

处理数据 给数据换名字

Completely delete MySQL in Linux system

都在说DevOps,你真正了解它吗?

Embedded classic communication protocol

Starfish Os X MetaBell战略合作,元宇宙商业生态更进一步

LeetCode高频题128. 最长连续序列,经常被互联网大厂面试考到

【面试:并发篇28:volatile】有序性

存储成本降低 80%,有赞数据中台成本治理怎么做的?
随机推荐
Zkrollup learning materials summary
华为APP UI自动化测试岗面试真题,真实面试经历。
Custom type: structure, enumeration, union
测试/开发程序员的级别“陷阱“,级别不是衡量单维度的能力......
Gbase 8C backup control function (III)
JS what situations can't use json Parse, json.stringify deep copy and a better deep copy method
存储成本降低 80%,有赞数据中台成本治理怎么做的?
GBase 8c 注释信息函数
mongodb/mongoTemplate.upsert批量插入更新数据的实现
GBase 8c 备份控制函数(二)
Open source flight control (Px4, ardupilot)
DeviceXPlorer OPC Server支持哪些设备?本文已列举出来了
GBase 8c 恢复控制函数
每条你收藏的资讯背后,都离不开TA
石油化工行业迎战涨价大潮,经销商分销系统平台数字化赋能经销商与门店
A Tiger's Tale
Unreal ue4.27 switchboard porting engine process
Gbase 8C transaction ID and snapshot (III)
sftp文件/文件夹上传服务器
Gbase 8C transaction ID and snapshot (I)