-
21 Dec 2012 7:16 AM #1
[4.2.0beta] Ext.view.Table.refreshSize() error
[4.2.0beta] Ext.view.Table.refreshSize() error
if grid is undefinedCode:refreshSize: function() { var me = this, grid, bodySelector = me.getBodySelector(); // On every update of the layout system due to data update, capture the view's main element in our private flyweight. // IF there *is* a main element. Some TplFactories emit naked rows. if (bodySelector) { me.body.attach(me.el.child(bodySelector, true)); } if (!me.hasLoadingHeight) { grid = me.up('tablepanel'); // Suspend layouts in case the superclass requests a layout. We might too, so they // must be coalescsed. Ext.suspendLayouts(); me.callParent(); // If the OS displays scrollbars, and we are overflowing vertically, ensure the // HeaderContainer accounts for the scrollbar. // If we need to measure row heights, update the layout if (grid && (Ext.getScrollbarSize().width && me.scrollFlags.y) || (grid.lockable && grid.syncRowHeight) ) { grid.updateLayout(); } Ext.resumeLayouts(true); } },
Code:(grid.lockable && grid.syncRowHeight)
Maybe should beTypeError: grid is undefined
?Code:if (grid && ((Ext.getScrollbarSize().width && me.scrollFlags.y) || (grid.lockable && grid.syncRowHeight)) )
-
29 Dec 2012 10:46 PM #2
In what case is grid undefined? Please post a test case.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
2 Jan 2013 5:44 AM #3
This is moot anyway now. The grid always has to be layed out, so there's no conditional there now.
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
2 Jan 2013 10:59 AM #4
However, the condition itself
is incorrect, IMHO...Code:var a = undefined, b = false; if(a && b || a.smthProperty) alert("1");
-
3 Jan 2013 6:35 AM #5
I have the same problem when I trying to close the window.
Notice I set autoDestroy=true to my store. If it's false everything gone Ok :-?
Code:Ext.define('Employee', { extend: 'Ext.data.Model', fields: [ {name: 'rating', type: 'int'}, {name: 'salary', type: 'float'}, {name: 'name'} ] }); Ext.onReady(function(){ function createFakeData(count) { var firstNames = ['Ed', 'Tommy', 'Aaron', 'Abe', 'Jamie', 'Adam', 'Dave', 'David', 'Jay', 'Nicolas', 'Nige'], lastNames = ['Spencer', 'Maintz', 'Conran', 'Elias', 'Avins', 'Mishcon', 'Kaneda', 'Davis', 'Robinson', 'Ferrero', 'White'], ratings = [1, 2, 3, 4, 5], salaries = [100, 400, 900, 1500, 1000000]; var data = []; for (var i = 0; i < (count || 25); i++) { var ratingId = Math.floor(Math.random() * ratings.length), salaryId = Math.floor(Math.random() * salaries.length), firstNameId = Math.floor(Math.random() * firstNames.length), lastNameId = Math.floor(Math.random() * lastNames.length), rating = ratings[ratingId], salary = salaries[salaryId], name = Ext.String.format("{0} {1}", firstNames[firstNameId], lastNames[lastNameId]); data.push({ id: 'rec-' + i, rating: rating, salary: salary, name: name }); } return data; } var store = Ext.create('Ext.data.Store', { id: 'store', buffered: true, autoDestroy: true, pageSize: 5000, data: createFakeData(5000), model: 'Employee', proxy: { type: 'memory' } }); var grid = Ext.create('Ext.grid.Panel', { width: 700, height: 500, store: store, loadMask: true, selModel: { pruneRemoved: false }, viewConfig: { trackOver: false }, //plugins: "bufferedrenderer", columns:[{ xtype: 'rownumberer', width: 40, sortable: false },{ text: 'Name', flex:1 , sortable: true, dataIndex: 'name' },{ text: 'Rating', width: 125, sortable: true, dataIndex: 'rating' },{ text: 'Salary', width: 125, sortable: true, dataIndex: 'salary', align: 'right', renderer: Ext.util.Format.usMoney }] }); var win = Ext.create('Ext.window.Window', { title: '[4.2.0beta] Ext.view.Table.refreshSize() error:', items: grid, layout: 'fit', autoDestroy: true, padding: 1, constrain: true, maximizable: true, closeAction:'destroy', autoShow: true }); });
-
8 Jan 2013 2:47 AM #6
Ok then. When store is autoDestroy = true, gridPanel tried to kick store on grid.destroy (you die with me!). Everything is ok until store is not buffered.
But when store is buffered it create PageMap and then we have following behavior:
- I call gridPanel.destroy()
- gridPanel.destroy kick children (call gridView.destroy)
- gridView.destroy call gridView.ownerCt.remove(me) and then call store.destroyStore
- store.destroyStore call store.clearData
- store.clearData call store.data.clear (PageMap.clear method)
- PageMap.clear call parent method (Ext.util.HashMap.clear) which fire 'clear' event.
- store listen that event with method store.onPageMapClear and fire it own 'clear'
- gridView got that 'clear' event and tried to refresh
- gridView.refresh call gridView.refreshSize which call gridView.up('tablepanel');
- and here we are! gridView.ownerCt is null... (see step 3!!!)


Reply With Quote