@swimlane/ngx-datatable virtual scroll works only with cached rows

Viewed 1094
1 Answers

My hack solution is simulate cached rows: For example user request take: 20 rows, skip: 50 rows, total rows: 100; Create array of 'undefined' (with length 100), and replace 20 rows starts from 50-th row;

const totalRow = 100;
const skip = 50;
const take = 20;
const serverRow = [{...}] // array of row, with length = 20;

const resultList = new Array(totalRow).fill(undefined);
resultList.splice(skip, serverRow.length, ...serverRow);

I check this solution with 10 million rows and it is works really fast; Maybe this will help someone.

Related