简体   繁体   English

ExtJS Panel使用contentEl自动调整大小

[英]ExtJS Panel auto resize with contentEl

I created a panel as 我创建了一个面板

Ext.create("Ext.panel.Panel", {
renderTo: Ext.getBody(),
contentEl: 'myDiv',
id: 'mypanel'
});

where the 'myDiv' is “ myDiv”在哪里
<div id="myDiv">
<table id="table1" border="1" cellspacing="1" cellpadding="2">
</table>
</div>

When I add rows to the HTML table, the panel doesn't adjust its height automatically to accommodate the complete table. 当我在HTML表格中添加行时,面板不会自动调整其高度以容纳整个表格。

Please let us know if I can achieve it by some configuration to the panel instead of calling panel.doLayout() every time when I add a new row. 请告知我们是否可以通过对面板进行某种配置来实现它,而不是每次添加新行时都调用panel.doLayout()。

Example fiddle: https://fiddle.sencha.com/#fiddle/33i 小提琴示例: https : //fiddle.sencha.com/#fiddle/33i

Thanks in advance. 提前致谢。

No, not possible. 不,不可能。 The reason you need to run the layout is because you're modifying an element in the DOM that Ext doesn't know about or measure. 您需要运行布局的原因是因为您正在修改Ext中不了解或无法度量的DOM中的元素。 The only reasonable "automatic" way to do that would be to use a timer and check if the DOM has changed, which isn't a good solution. 唯一可行的“自动”方法是使用计时器并检查DOM是否已更改,这不是一个好的解决方案。

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

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