简体   繁体   English

ExtJS和简单的网格面板

[英]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). 原材料和列中的人员只需要几天的装载量(假设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!!! 而且此过程需要3分钟以上!!! 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! 单元格更新可能意味着网格需要刷新自身,因此它做到了31x20x5(31行,20列,每个单元格5次)的时间!

Instead, do this: 相反,请执行以下操作:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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