javascript extjs 网格真正的完整 afterrender 事件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11736537/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 14:11:05  来源:igfitidea点击:

extjs grid real full afterrender event?

javascripteventsextjsgrid

提问by Lev Savranskiy

i am having extjs GridPanel

我有 extjs GridPanel

when i load store:

当我加载存储时:

I do Ext.getBody().mask();

Grid 'afterrender' event fires first

Store 'load' event fires second

I attached unmask function to  store load 'event'

but there are few moments after that event, when i see white grid (between unmask and rows populating).

但是在那次事件发生后不久,当我看到白色网格(在取消屏蔽和填充行之间)时。

what is the proper way to unmask on real full afterrender event? i mean - when all rows are rendered.

在真正的完整渲染事件中揭开面具的正确方法是什么?我的意思是 - 当所有行都被渲染时。

Thanks

谢谢

回答by vanderwyst

I was going to suggest the gridview's loadMaskconfig as covered herein the docs. But I noticed that it wasn't working for me for some reason.

我要建议GridView的loadMask所涵盖的配置在这里的文档。但我注意到由于某种原因它对我不起作用。

If it doesn't work for you either, just use the gridview's refreshevent as covered here. It will only fire after the data is fully loaded into the grid. You can attach it through your gridpanel's viewConfigconfig like so:

如果它也不适合您,只需使用此处refresh介绍的 gridview事件。它只会在数据完全加载到网格后触发。您可以通过 gridpanel 的配置附加它,如下所示:viewConfig

Ext.create('Ext.grid.Panel', {
    title: 'My Grid Panel',
    // ... other grid panel configs
    viewConfig: {
        listeners: {
            refresh: function(gridview) {
                console.log(gridview);
                console.log('is fully loaded');
            }
        }
    },
});

Or if you are using MVC app architecture:

或者,如果您使用的是 MVC 应用程序架构:

Ext.define('MyApp.controller.MyController', {
    extend: 'Ext.app.Controller',

    models: ['MyModel'],

    stores: ['MyStore'],

    views:  ['MyGridPanel'],

    init: function() {
        var me = this;

        me.control({

            // ... other event handlers

            'mygridpanel > gridview': {

                refresh: function(gridview) {
                    console.log(gridview);
                    console.log('is fully loaded');
                }

            },
        });
    }
});