加载数据后如何刷新面板? [英] How to refresh a panel after data is loaded?

查看:27
本文介绍了加载数据后如何刷新面板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 div 中渲染了一个 extjs 面板,如下所示:

I have a extjs panel rendered inside a div like this:

panel = new Ext.Panel({
            layout : 'fit',
            renderTo: 'my_div',
            monitorResize: true, // relay on browser resize
            height: 500,
            autoWidth: true,
            items : [
                centerPanel
            ],
            plain : true
        });

页面加载后面板是空的,但是当我调整浏览器大小时,内容会神奇地出现!

After the page has loaded the panel is empty, but when I resize the browser the contents appears by magic!

我认为第一次渲染面板时数据还没有加载完成.

I think the data has not finished loading when the panel is rendered the first time.

如何在不调整浏览器大小的情况下显示内容?

How can I get the contents to show without resizing the browser?

推荐答案

我怀疑问题在于您需要明确地使面板呈现.创建面板后,进行以下调用:

I suspect the issue is that you need to explicitly cause the panel to be rendered. After creating the panel, make the following call:

panel.doLayout();

Sencha 文档说在将新组件添加到已呈现的容器后,或者可能在更改子组件的大小/位置属性后,需要调用此函数."

Sencha documentation says "A call to this function is required after adding a new component to an already rendered container, or possibly after changing sizing/position properties of child components."

这篇关于加载数据后如何刷新面板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆