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

Comparison between hardware SPI and software analog SPI rate

Cloud native enthusiast weekly: the evolution of Prometheus architecture

萤石网络,难当「孤勇者」

Data security and privacy computing summit - provable security: Learning

ArcGIS:加载历史遥感影像

Machine learning how to achieve epidemic visualization -- epidemic data analysis and prediction practice

Codeforces Round #807 (Div. 2) A-C题解

Digital economy is the core of future economic development

2022 software testing skills robotframework + selenium library + Jenkins web Keyword Driven Automation practical tutorial

Packet capturing wizard netcapture app packet capturing tutorial "complete"
随机推荐
Simplicity for beauty - programming ideas
Gbase 8C transaction ID and snapshot (V)
mongodb/mongoTemplate.upsert批量插入更新数据的实现
机器学习如何做到疫情可视化——疫情数据分析与预测实战
LeetCode第 83 场双周赛
Enterprise operation and maintenance practice - using aliyun container image service to pull and build images of overseas GCR and quay warehouses
Use of recursion: 1. Convert the tiled array to a tree 2. Convert the tree to a tiled array
Gbase 8C general file access function
Gbase 8C transaction ID and snapshot (III)
Unity universal red dot system
IT这个岗位,人才缺口百万,薪资水涨船高,上不封顶
What are the important applications of MES system in manufacturing enterprises
What devices does devicexplorer OPC server support? This article has listed
FreeRTOS kernel summary
软件测试面试题:常见的 POST 提交数据方式
Mark's story
网易云仿写
GBase 8c 事务ID和快照(六)
石油化工行业迎战涨价大潮,经销商分销系统平台数字化赋能经销商与门店
Gbase 8C backup control function (I)