Ext.grid.ColumnLayout [4.1.1]
I'm having a hard-time replicating a runtime exception I'm having with a treegrid inside a window.
The treegrid is the only child of a window, and whenever I expand a node which causes a vertical scrollbar to appear, I'm getting a runtime exception in calculate(): viewContext.tableContext is undefined.
This previously worked in 4.0.7 and got broken in 4.1.1. Comparing the files shows that there has been a significant change in that file. Unfortunately the inner-workings of the optimized layout effort are not documented, so I have no idea what tableContext is, or why it's undefined.
As a workaround, I added if(viewContext.tableContext) and things started working again.
Strangely enough, if I set 'animate' to true (I turned it off in my product), it works as expected.
Help, anyone?
calling setWidth() with the same width as the control
After further investigation it turns out that the root of the problem was that I handled the 'columnresize' event of the grid and called column.setWidth() with the same value.
Instead of checking if the new width is different from the current width, this triggered updateLayout(), which subsequently crashed in Ext.grid.ColumnLayout.calculate()
Here's a reproduction for this:
Code:
Ext.onReady(function ()
{
Ext.create('Ext.Window', {
title: 'bug',
width: 400,
height: 160,
x: 10,
y: 450,
plain: true,
modal: true,
layout: 'border',
items: {
xtype: 'treepanel',
region: 'center',
border: false,
hideHeaders: true,
columns: [{ xtype: 'treecolumn', text: 'Name', dataIndex: 'text', flex: 1, padding: '10 10 10 10', draggable: false, hidable: false}],
listeners:
{
columnresize: function (container, column, width, opts)
{
column.setWidth(width);
}
}
},
}).show();
});