extjs - How to optimize adding components to a view? -
first of all, have 1000-1500 records , need show them in grid in custom style. but, first row has contain checkbox , form(combo,textfield), below checkbox. similar to:
row1: checkbox combo, textfield, textfield row2: checkbox combo, textfield, textfield ...
so, not use grid approach(because have use 'colum render function' each row , causes re-render whole grid again if change 1 row).
that's why tried add each component panel dynamically. main problem whenever add components panel, takes long . example, takes 4.5 s 100 records. can't imagine how long take 1500 records.
please check fiddle. understand exact problem. please not forget check console.time:
https://fiddle.sencha.com/#fiddle/13g0
and sample codes:
console.time('fakegrid'); ext.suspendlayouts(); var fakegrid = ext.create('ext.panel.panel', { title: 'fake grid panel', renderto: ext.getbody(), }); var records = []; for(var i=0; < 10; i++) { records.push({ id: 'check'+ i, reg: 'reg' + }) } ext.each(records, function(rec) { var regionpanel = { xtype: 'fieldset', collapsible: true, border: false, title: rec.reg, layout: 'vbox', items: [] }; ext.each(records, function(rec) { var hboxpanel = { xtype: 'panel', layout: 'hbox', items: [{ xtype: 'checkbox', boxlabel: rec.id }] }; var fakesubpanel = ext.create('ext.panel.panel', { layout: 'hbox', items: [{ xtype: 'combobox', fieldlabel: 'combo' }, { xtype: 'textfield', fieldlabel: 'field1' }, { xtype: 'textfield', fieldlabel: 'field2' }] }); var sitepanel = { xtype: 'panel', layout: 'vbox', //margin: '5 0 0 31', items: [hboxpanel, fakesubpanel] }; regionpanel.items.push(sitepanel); }); //ext.each fakegrid.add(regionpanel); }); //ext.each ext.resumelayouts(true); console.timeend('fakegrid');
if have suggestion, please enlight me ideas. thank much!
Comments
Post a Comment