right .
my problem is that i a have a large data , 100K records.
and as i mentioned before im running the merge only for rendered cells, [for performance issue , im not going to merge the overall column].
mean, when do a sort, a new data will be rendered [during this functionality i updated the mergeCells object "code below"],
and after rendered finish, there should be an event to execute the merge functionality.
im looking up for that event . to execute :
this.option("mergeCells", _grid._mergeCells);
this.refreshView();
code below:
renderCell(ui) {
let rowData = ui.rowData;
let dataIndx = ui.dataIndx;
let pq_style = {};
let reOrderRowIndex = rowData.pq_order != null ? rowData.pq_order : ui.rowIndx;
let cellConfiguration = this._grid.getConfiguration(ui.column.nameIndx,reOrderRowIndex,null);
if (cellConfiguration.MERGE_ROWS){
this.updateMergeRowsIndexes(ui.column.nameIndx,ui.rowIndx ,reOrderRowIndex, dataIndx );
}
// get cell format style properties
let cellStyle = this.getCellStyle(cellConfiguration);
cellStyle.cell_format += ui.cellData;
pq_style.style = cellStyle.css;
rowData.pq_cellattr = rowData.pq_cellattr || {};
rowData.pq_cellattr[dataIndx] = pq_style;
return "<span class='vx-align-middle'></span>" + cellStyle.cell_format ;
}
updateMergeRowsIndexes (colIdx, rowIdx, reOrderRowIndex,dataIndx){
let curCellData = this._grid._compData.data.columns[colIdx][rowIdx];
let prevCellData = this._grid._compData.data.columns[colIdx][rowIdx-1] !== undefined ? this._grid._compData.data.columns[colIdx][rowIdx-1] : undefined;
let currCellConfiguration = this._grid.getConfiguration(colIdx, reOrderRowIndex,null);
let prevCellConfiguration = this._grid.getConfiguration(colIdx, reOrderRowIndex-1,null);
// check current merge object position is already defined
let currMergeObj = _.find(this._grid._mergeCells,{"rd": rowIdx-1 , "c1":dataIndx});
if (prevCellData !== undefined && prevCellData == curCellData && this.isCellStyleConfigurationEquivalent(currCellConfiguration, prevCellConfiguration)){
if (this._grid._mergeCells.length == 0 || !currMergeObj){
this._grid._mergeCells.push({r1: rowIdx-1, c1: dataIndx, rc: 2, cc: 1, rd:rowIdx});
} else{
currMergeObj.rc ++;
currMergeObj.rd = rowIdx;
}
}
}