View Full Version : [CLOSED] [4.2.0] Ext.suspendLayouts causes a menu to be not rendered

2 Apr 2013, 9:48 PM

Ext version tested:

Ext 4.2.0 GA

Browser versions tested against:


DOCTYPE tested against:

<!DOCTYPE html>


An Ext.suspendLayouts call causes a menu to be not rendered. Please follow the test case.
Initially, suspending layouts is used to improve performance of the TreePanel to reduce the delay on node expanding. It is used with ExtJS 4.1, because it doesn't support buffered rendering for trees yet. But it somehow causes a context menu to be not rendered on some scenario (see the steps to reproduce). And it is reproducible with 4.2, so, I am reporting it. Maybe, it breaks the normal event flow, that is why it causing the problem, but there is, potentially, a problem with layouting.

Steps to reproduce the problem:

Click the Load button
Right click on the node

The result that was expected:

The context menu appears.
It does appears if do either:

Right click the node before clicking the Load button
Or remove suspendLayouts/resumeLayouts calls
Or replace them with, respectively, "this.suspendLayout = true;" and "this.suspendLayout = false; this.doLayout();" for the tree

The result that occurs instead:

The context menu doesn't appear

Test Case:

<!DOCTYPE html>
<title>Ext.suspendLayouts causes a menu to be not rendered</title>

<link rel="stylesheet" href="../resources/css/ext-all.css" />

<script src="../ext-all-debug.js"></script>

Ext.onReady(function () {
Ext.create("Ext.button.Button", {
renderTo: Ext.getBody(),
text: "Load",
handler: function () {
children: [{
text: 'new node'

Ext.create("Ext.tree.Panel", {
id: "TreePanel1",
renderTo: Ext.getBody(),
height: 200,
width: 200,
root: {
children: [{
text: "Initial node"
rootVisible: false,
contextMenu: Ext.create("Ext.menu.Menu", {
items: [{
text: "Some item"
listeners: {
render: {
fn: function () {
this.mon(this.el, 'contextmenu', function (e) {
}, this);
beforeitemexpand: {
fn: function () {
afteritemexpand: {
fn: function () {

3 Apr 2013, 5:15 AM
Thanks for the report! I have opened a bug in our bug tracker.

3 Apr 2013, 8:39 PM
One of the less obvious interactions between layouts and components is that layouts are where rendering takes place for new children. Though perhaps there are better ways to do this, this has historically been the case.

The practical effect of this in 4.1+ is that suspendLayouts then prevents this rendering by preventing (rather delaying) the layout. This is precisely why we were unable to auto-batch layouts. Changing this interaction would have profound effect on timing of events that would probably produce an enormous regression for people - my early Ext JS apps would often have logic in afterrender or afterlayout somewhat at random and it "just worked".

I'm afraid this is one we cannot "fix" because the fix would require fully decoupling rendering from layout and that would be a next-generation kind of thing.

3 Apr 2013, 9:12 PM
Don, thank you for the detailed answer. Fair enough.

Well, probably, such problems can appear seldom, but, I think, this fact is very noteworthy to be in these guides;)

Currently, I updated the performance guide and thread to warn the people.