Wait! Looks like we don't have enough information to add this to bug database. Please follow this
template bug format.
-
Sencha Premium Member
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?
-
We will need a working example. Please follow our bug report template:
http://www.sencha.com/forum/showthre...o-report-a-bug
Regards,
Scott.
-
Sencha Premium Member
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();
});
-
Obviously the code is for the sake of example, but why are you manually setting the width on it after the column gets resized?
Twitter - @evantrimboli
Former Sencha framework engineer, available for consulting.
As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.
-
Sencha Premium Member
Well naturally I don't, directly. This was just a simplification of the issue.
In my application, a class that wraps the grid component container some the logic that at some point called setWidth(). Once I found it I fixed it, but this does not mean that calling setWidth() should be unsafe during the columnresize event or updateLayout() etc.
-
I'm experiencing this issue as well, except that it's not during a columnresize event, it's due to my ColumnAutoWidth plugin calling setWidth after catching a (buffered) refresh event.
I don't see why it's ok for setWidth to ever cause a crash. Docs on the layout stuff would be nice too.
This thread is still marked as "not enough information" even though alonweiss has submitted a reproduction scenario. Is this sufficient to get this looked at? or shall I resubmit his reproduction in another thread?
-
What's the status of this? I'm still experiencing this issue.
alonweiss provided a good reproduction case back in July. It should not be marked as needing more information.
-
It would be useful to see a real world test case, the one provided above is a bit contrived.
Twitter - @evantrimboli
Former Sencha framework engineer, available for consulting.
As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.