当使用grid布局时,我们会碰到列比较多的情况。这时候渲染和响应都比较慢,请问有什么优化方案么?
例子类似如下:
- var columns = []
- for (let i = 0; i < 20; i++) {
- const o = {
- caption: i,
- columns: [],
- };
- o.columns = [];
- for (let j = 0; j < 10; j++) {
- o.columns.push({
- id: `${Date.now()}_${j}`,
- dataField: `${Date.now()}_${j}`,
- caption: `${Date.now()}_${j}`,
- minWidth: 100,
- });
- }
- columns.push(o);
- }
- console.time('run');
- new GC.Spread.Views.DataView(
- document.querySelector('#grid1'),
- [],
- columns,
- new GC.Spread.Views.Plugins.GridLayout({
- rowHeight: 40,
- }),
- );
- console.timeEnd('run');
复制代码
|
|