Posted 14 November 2018, 3:26 am EST
Hi,
Yes, there will be performance issues if a large number of cells are present, This is because it will calculate every cell’s width/height.
There are some performance improvements which you can make by avoiding some common pitfalls.
- Instead of calling autoSizeColumns(which auto size every column), use autoSizeColumn to resize only the columns which need resizing.
Identify which are the columns that actually need resizing. Sometimes columns with types like ‘Date’, ‘Checkbox’… are used which rarely needs resizing. A formatted date column would have the same text width throughout the rows. So you can calculate the width once and apply it.
- Use deferUpdate method. The deferUpdate method ensures that FlexGrid will not refresh until all its included operations have been applied. So your new updateLayout method would look something like this:
function updateLayout(s, e) {
if (isLoad) {
isLoad = false;
s.deferUpdate(function(){
s.autoSizeColumn(1);
s.autoSizeColumn(3);
s.autoSizeColumn(4);
});
}
}
- If you are using autoSizeXXXX methods on a grid with a large number of rows, try implementing Paging in your grid.
https://demos.componentone.com/ASPNET/MVCExplorer/FlexGrid/Paging
Let me know if you face more performance issues.