PDA

View Full Version : [CLOSED] Performance. Live row add



odyssey
Sep 29, 2014, 11:18 AM
I am facing performance issue if I want to add data in store in specific time intervals .For example


lateBind: function (data) {
var rec = 0;
var grdStore = Ext.getStore('storeLiveSetData');
console.log('late binding');
bindIntervalId = window.setInterval(function () {
if (rec < data.length) {
grdStore.add(data[rec]);
Ext.getCmp('sbSearchResult').setText('Records : ' + grdStore.data.length);
} else {
window.clearInterval(bindIntervalId);
}
rec++;
}, 250);
}

The problem starts after 80th records is being added to the Grid and eventually interface becomes unresponsive. Interesting thing is that rows are added 20 per server request so there is time between request

Daniil
Sep 29, 2014, 1:08 PM
Hi @odyssey,

I guess there is a possibility that

window.clearInterval(bindIntervalId);
doesn't clear the intervals, because of the fact that the bindIntervalId variable is a global one.

odyssey
Sep 29, 2014, 1:22 PM
Well I wish that was the problem . I edited code for simplification.Actually bindIntervalId is mssoc.live_search.fn.bindIntervalId


lateBind: function (data) {
if (data.length == 0) { return; }
var rec = 0;
var grdStore = Ext.getStore('storeLiveSetData');
console.log('late binding');
var arr = []; // tried to put in array before adding to store
mssoc.live_search.fn.bindIntervalId = window.setInterval(function () {
if (rec < data.length) {
arr.push(data[rec]);// here it did not help
grdStore.add(arr);
grdStore.sort('coldatetime', 'desc');
Ext.getCmp('sbSearchResult').setText('Records : ' + grdStore.data.length);
} else {
window.clearInterval(mssoc.live_search.fn.bindInte rvalId);
arr = [];
mssoc.live_search.fn.bindChart();
grdStore.commitChanges(); //nor this helped
}
rec++;
}, 250);
}


Here I even tried commitChanged and before adding to store I am pushing it to array but it did not help.

Daniil
Sep 29, 2014, 5:01 PM
Well, it is difficult to say anything concrete without a full test case to reproduce the problem.