PDA

View Full Version : Going Batty, what am I missing? 2 identical functions, 1 comes back undefined



Tumac
25 Oct 2010, 6:14 PM
Going batty. Getting error "tallySummary" is undefined on Codeset #1

Codeset #2 executes as expected.

I know the grid xtype: transittallydetail exists because I use it just fine on another part of the application.

Usually these things are typos with me, but I have looked at this so long I am batty. Please don't find a typo, I will shoot myself.

Codeset #1 <-----Problem Code



,buildDetailGrid : function() {

return {
xtype : 'transittallydetail'
,region : 'south'
,itemId : 'tallySummary'
,height : 200
,flex : 1
,loadMask : true
,style : 'background-color: #E8EDEA; padding: 10px'
};
}


,loadData : function(data) {
STScls.form.DashTransitSummary.superclass.loadData.apply(this, arguments);
this.loadDetailGrid();
}

,loadDetailGrid : function(data) {
if (this.data && this.data.container ) {

this.getComponent('tallySummary').load({
params : {
container : this.data.container
}
});
}

}



Codeset #2 <------- Works as expected


,buildDetailGrid : function() {

return {
xtype : 'podetailgridpanel'
,region : 'south'
,itemId : 'podetailGrid'
,height : 200
,flex : 1
,loadMask : true
,style : 'background-color: #E8EDEA; padding: 10px'
};
}

,loadData : function(data) {
STScls.form.DashPOSummary.superclass.loadData.apply(this, arguments);
this.loadDetailGrid();
}

,loadDetailGrid : function(data) {
console.log(data);
if (this.data && this.data.poID ) {

this.getComponent('podetailGrid').load({
params : {
poID : this.data.poID
}
});
}

}

lsaffre
25 Oct 2010, 7:19 PM
I'm happy I couldn't find any typo ;-) But what happens if you insert a line "console.log(this.items);" before the line "this.getComponent('tallySummary')"? Using FF or Chrome. Is the tallySummary grid one of the items?

Tumac
25 Oct 2010, 8:12 PM
Parsing the dom object stuff in debugging is my weakest part as I don't always know what I am looking for.

Just for grins, I put the podetailgrid xtype into the transittally spot and have same result, so it has to be something in the current script and not the grd coming back as undefined.

Finer tooth comb coming out.......

Animal
25 Oct 2010, 9:27 PM
Well of course what you posted is not the actual code, so nobody can debug.

Tumac
25 Oct 2010, 10:34 PM
I am contemplating my next move. I don't want to waste too much forum time. Gonna sleep on it and look at it fresh tomorrow and post more code if necessary.

Tumac
26 Oct 2010, 7:25 AM
I was not calling the function properly to build the grid, so in essence a typo.

,initComponent : function() {
this.items = [
this.buildForm()
,this.buildDetailGrid()
];


On the this.buildDetailGrid(), I forgot to put the ()