当前位置:网站首页>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;
},边栏推荐
猜你喜欢

What is method and methodology: understand the underlying logic of self-improvement

二叉树的遍历和性质

Starfish OS X metabell strategic cooperation, metauniverse business ecosystem further

hypermesh 圆周阵列-插件

uniapp 总结篇 (小程序)

每条你收藏的资讯背后,都离不开TA

Small bulk quantitative stock trading record | data is the source in the quantitative system, which teaches you to build a universal data source framework

Completely delete MySQL in Linux system

Collection / container

云原生爱好者周刊:Prometheus 架构演进之路
随机推荐
Software testing interview question: what types of software testing are you familiar with?
Use of recursion: 1. Convert the tiled array to a tree 2. Convert the tree to a tiled array
Gbase 8C transaction ID and snapshot (III)
Digital economy is the core of future economic development
在生产型企业中,MES系统有哪些重要应用
Redis design specification
GBase 8c 配置设置函数
54:第五章:开发admin管理服务:7:人脸入库流程;人脸登录流程;浏览器开启视频调试模式(以便能够在本机的不安全域名的情况下,也能去开启摄像头);
软件测试面试题:为什要在一个团队中开展测试工作?
ArcGIS:加载历史遥感影像
Software testing interview question: why should we carry out testing in a team?
Software test interview question: please introduce the meaning of various test types in detail?
软件测试面试题:你认为做好测试用例设计工作的关键是什么?
【网站搭建】使用acme.sh更新ssl证书:将zerossl改为letsencrypt
数据输出-图片注释、标注
Starfish OS X metabell strategic cooperation, metauniverse business ecosystem further
LeetCode 第 302 场周赛
Gbase 8C backup control function (IV)
学习了循环碰到了编写计算n的阶乘的题目,由此引发了一系列问题,包括一些初学者常见的坑,以及如何简化代码
Leetcode high frequency question 128. the longest continuous sequence, which is often tested in interviews with Internet companies