PDA

View Full Version : this.lastSize is undefined



Joyfulbob
17 May 2013, 12:13 PM
Getting this on a TabPanel when loading just 2 tabs; one a form and the other has a grid with a panel.

Couldn't find anything out in FireBug or Break on All Errors.

I've tried the 'SyncHeight' plane override, but that loops.



var poiPreviewPane = new Ext.Panel({
id: 'poiPreviewPane',
region:'south',
height: 75,
width: 600,
title:'Preview',
autoScroll: true
});

var ddcEditGrid = new Ext.extend(Ext.grid.EditorGridPanel, {

initComponent: function() {
...

Ext.apply(this,{
id: 'ddcEditGrid',
region:'center', //for tab panel since it holds 2 containers; grid & preview pane
store: ddcDataStore,
cm: ddcColumnModel,
clicksToEdit:1,
stripeRows: true,
loadMask: true,
stateful: false,
border:false,
frame:false,
height: 465,
viewConfig:{emptyText:'No rows to display'},
plugins: [ piPrjmary ],
view: new Ext.grid.GroupingView({
startCollapsed: false,
enableRowBody: false,
hideGroupedColumn: false,
groupTextTpl: '{text} - {[ values.rs[0].data["INVDTM"] ]} : {[values.rs.length]} {[values.rs.length > 1 ? "Invoices" : "Invoice"]}'
}),
selModel: ddcSelModel
}); // eo apply

...
var centerPanel = new Ext.TabPanel({
region:'center',
id:'center-panel',
deferredRender: false,
activeTab:0,
layoutOnTabChange: true,//only useful if a form in a tab and using IE
//anchor: '100% 100%',
enableTabScroll:true,
defaults: {autoScroll:true},
items:[ {
title:'Service Billing',
id: 'poiServiceBilling',
xtype: 'panel',
layout: 'border',
height: 625,
hidden: true,
items: [
{
id: 'ddcEditGrid',
xtype: 'ddcEditGrid'
},
poiPreviewPane
]
} ]
})
...
var viewport = new Ext.Viewport({
id: 'viewport',
layout:'border',
stateful: false,
items:[
new Ext.BoxComponent({
region:'north',
el: 'north',
hidden:true,
height:32
}),{
region:'west',
id:'west-panel',
title:'SiteCentrl',
split:true,
width: 200,
minSize: 175,
maxSize: 400,
collapsible: true,
margins:'0 0 0 5',
layout:'accordion',
stateful: false,
layoutConfig:{
animate:true
},
centerPanel
]
});

mitchellsimoens
20 May 2013, 5:32 AM
When does this error get thrown? What debugging have you done? Have you tried simplifying with regular components in the tab panel?

Joyfulbob
20 May 2013, 5:41 AM
It gets thrown on the initial page load. I've stripped out everything but the grid (ddcEditGrid).

I've turned on Break on All Errors and it was on the syncHeight on this line:

lsh = this.lastSize.height
and I get undefined. It was on the grid's toolbar, but we never have heights on our toolbars. So I added a height to it and still got the error.

Now, Firebug does not break on this error?! Why did that happen?



tbar: [
' All Sites ',
{
id: 'allSites',
xtype: 'checkbox',
listeners: {
'render': {
fn: function(c) {
Ext.QuickTips.register({
target: c.getId(),
text: 'Filter all Sites; not just this one'});
},
scope: this
}
}
},' ',{
id: 'ddcENPCDfilter',
name: 'ddcENPCDfilter',
xtype: 'textfield',
selectOnFocus: true,
emptyText: 'EntPr...',
//style: {textTransform: 'uppercase'},
width: 60
},' ',{
id: 'ddcGSWfilter',
name: 'ddcGSWfilter',
xtype: 'combo',
selectOnFocus: true,
emptyText:'Frequency...',
//style: {textTransform: 'uppercase'},
width: 80,
//listWidth: 120,
hiddenName:'GWSfield',
store: new Ext.data.SimpleStore({
fields: ['key', 'label'],
data: [[' ','All'],['M','Monthly'],['1','Annually'],['2','2 years'],['3','3 years']]
}),
valueField:'key',
displayField:'label',
mode: 'local',
triggerAction: 'all',
selectOnFocus:true,
forceSelection: false,
minChars: 0,
autoComplete: 'off'
},' ',{
text: '',
iconCls: 'db_Refresh',
//margin: 80,
style: {marginLeft: '60px'},
width: 25,
handler: function(){
ddcDataStore.baseParams.allSites = allSites.checked;
ddcDataStore.baseParams.sitidi = thdSITIDfield.getValue();
ddcDataStore.baseParams.enpcdi = Ext.getCmp('ddcENPCDfilter').getValue();
ddcDataStore.baseParams.gswi = Ext.getCmp('ddcGSWfilter').getValue();
ddcDataStore.load();
}
},'-',{
text: 'Add Service Billing', tooltip:'Add a new Document', handler: this.dspddcFormWindow.createDelegate(this),
iconCls: 'add'
}]


My next step is to strip out ddcEditGrid code until it goes away.

43877

Joyfulbob
20 May 2013, 5:44 AM
FYI, we're at V3.3.1; I wonder if it goes away atV3.4?

Joyfulbob
20 May 2013, 5:51 AM
FYI, this code fixes the error but then we get too much recursion as this function loops. So I took out this code and then we got the this.lastSize ins undefined error.

I'd rather not have this code to completely avoid too much recursion.


Ext.override(Ext.Panel, {
syncHeight : function(){
if(!(this.autoHeight || this.duringLayout)){
console.info('duringLayout:' + this.id);//RK..5.17.13 debug
var last = this.lastSize;
if(last && !Ext.isEmpty(last.height)){
var old = last.height, h = this.el.getHeight();
if(old != 'auto' && old != h){
var bd = this.body, bdh = bd.getHeight();
h = Math.max(bdh + old - h, 0);
if(bdh != h){
bd.setHeight(h);
var sz = bd.getSize();
console.info('bodyresize:' + this.id);//RK..5.17.13 debug
//console.dir(this.el);//RK..5.17.13 debug
this.fireEvent('bodyresize', sz.width, sz.height);
}
}
}
}
}
});

Ultimately I'd like to know design-wise what is wrong. We have tons of tabpanels and its only happening on this one.

Joyfulbob
20 May 2013, 6:06 AM
If I remove everything from the toolbar and just have this I still get the error:



tbar: {
height: 35,
id: 'ddcToolbar',
items: [ ]
}

If I take out the toolbar completely it loads, which makes no sense??

Joyfulbob
20 May 2013, 9:15 AM
I needed to add this property to all the grids:


lastSize: 25,

Not sure why we weren't getting this error on our other apps; however it's working now.