EnhancedGrid滚动(包含大量数据)

时间:2013-02-19 21:27:24

标签: dojo dojox.grid

我正在使用由dojox.grid.EnhancedGrid类创建的MyGrid,如下所述。

var MyGrid = declare(null, {
    constructor: function (app, id, opts) {
       this.id = id;
       this.app = app;
       this.core_id = app.getCoreId();

       var myStore;

       var jquery = {
         scope: 'core',
         command: 'rest',
         args: {
           resource: this.id,
           serve: 'cooked'
         },
         core_id: this.core_id
       };

       this.jsonStore = new custom.store.JsonRest({
         target: app.get_dispatcher_url(),
         jquery: jquery,
         // setstruct is an object to provide a method that sets a new
         // grid structure as soon as data arrives.
         set_structure: dojo.hitch(this, this.set_structure),
         app: this.app
       });

       // avoid closures from holding a reference
       // to jquery and preventing its GCing
       jquery = null;

       this.memoryStore = new Memory();
       myStore = new Cache(this.jsonStore, this.memoryStore);


       this.dataStore = new ObjectStore({
         objectStore: myStore,
         onSet: onEdited,
         onNew: onEdited,
         onDelete: onEdited
       });

       myStore = null;

       // create grid
       this.grid = new EnhancedGrid({
         store: this.dataStore,
         height: '100%',
         structure: [
           { name: 'Waiting for data...', field: 'no-field', width: '10em' }
         ],
         plugins: {
           menus: { rowMenu: this._create_menu() },
           nestedSorting: true,
           selector: { row: 'disabled', col: 'disabled', cell: 'multi' }
         }
       });

       // start grid
       this.grid.startup();
    }
}); 

请注意,我省略了代码,只关注“grid / store”的创建。 MyGrid在ContentPane上显示网格。

所以我创建了一个对象来显示网格(包含大量数据)并滚动到底部,它只会正确地请求可见行。但是,当我创建第二个网格时,它会请求第二个网格的内容第一个网格的所有数据!

这怎么可能发生?有什么可能导致这种情况的想法吗?

EDITED(22/02/13):

我创建了一个jsfiddle来演示我遇到的问题:see jsfiddle

如何重现问题:

  1. 点击新标签按钮,打开控制台并检查提取的行数。
  2. 转到网格底部(快速)并再次检查控制台。
  3. 再次单击新标签,转到控制台,您可以看到已从上一个网格中获取所有未加载的行。
  4. 注意:我发现这只发生在 Google Chrome 上。我用 Firefox 进行了测试,一切运行良好。

0 个答案:

没有答案