简体   繁体   中英

ExtJS and simple grid panel

I have a simple grid without direct connection with any database table. Just days of mounth in raws and persons in columns (let's say 31 x 20). In init procedures I read data from some tables, calculate and write them to this grid. Then I have to calculate lot of indexes, make some summs by raws, columns and part of them. Just statistics.

There's no problem with read from grid cells, this is very quick. I have a problem with writing data to the cells. Eg procedure to fill this grid is the following:

days = Ext.getStore('StoreDays').getRange();
employees = Ext.getStore('StoreTeam').getRange();
Ext.each(days, function (day) {
    Ext.each(persons, function (guy) {
        tmp = day.get('from');
        day.set('start_' + persons.data.prs_numer, start);

        ... and 4 additional SET operations to grid cells
    });
});

And this procedure work more then 3 minutes!!! I don't know why and how to write good code to write this data normally. Be so kind and prompt me HOW! Additionally I can't refresh eg every single raw after raw settings as I want. Would you be so kind as to prompt me?

A cell update could mean the grid needs to refresh itself, so it does that 31x20x5 (31 rows, 20 columns, 5 times per cell) times!

Instead, do this:

store.suspendEvents();
// Do your update
store.resumeEvents();
grid.getView().refresh();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM