PDA

View Full Version : [SOLVED] TypeError: Result of expression 'config' [undefined] is not an object.



mikih
14 Jan 2011, 6:19 AM
Hi folks,

this is my first week workinf with the sencha touch framework and I am really tired of spending most of my hours with debugging... :).

I have a strange problem I can not reproduce..

I used some parts of the kiva example to make a list that opens a sheet on selectchange with details.

I get the following error when calling the superclass.initComponent in my below code:

TypeError: Result of expression 'config' [undefined] is not an object. (sencha-touch-debug.js:614).




app.views.purchaseOrders.Show = Ext.extend(Ext.Sheet, {
modal : true,
centered : false,
hideOnMaskTap : true,

cls : 'purchaseOrderShow',
layout : 'fit',
enter : 'right',
exit : 'right',
width : 400,
stretchY : true,

initComponent : function () {
Ext.apply(this, {
items : {
xtype : 'carousel',
items : [
this.getDetailsCard(),
]
},

dockedItems : [
{
xtype : 'button',
text : 'Reject',
ui : 'action',
dock : 'bottom',
listeners : {
tap : this.hideHandler
}
}, {
xtype : 'button',
text : 'Approve',
ui : 'action',
dock : 'bottom',
listeners : {
tap : this.hideHandler
}
}
]
});
app.views.purchaseOrders.Show.superclass.initComponent.apply(this, arguments);
},

setPurchaseOrder : function ( purchaseOrder ) {
this.instance = purchaseOrder;

if (this.rendered) {
this.updateCards();
} else {
this.on('show', this.updateCards, this);
}
},

getDetailsCard : function () {
return new Ext.Component({
tpl : new Ext.XTemplate('<h1>{description}</h1>', '<p class="overview">', '<strong>Status:</strong> {status}<br />', '<strong>id:</strong> {id}<br />',
'<strong>Supplier:</strong> {supplier}<br />', '<strong>SupplierNo.:</strong> {supplierNo}<br />', '<strong>Created By:</strong>{createdby}<br />',
'<strong>Total Amount:</strong> ${totalAmount}', '</p>', {
compiled : true
}),
itemId : 'detailsCard',
scroll : 'vertical',
styleHtmlContent : true,
html : '',
listeners : {
activate : function () {
if (this.scroller) {
this.scroller.scrollTo({
x : 0,
y : 0
});
}
}
}
});
},
/**
* @private This is used internally by the component to update the contents
* of each card.
*/
updateCards : function () {
var detailsCard = this.down("#detailsCard"), purchaseOrder = this.instance;

detailsCard.update(purchaseOrder.data);
}
});

Ext.reg('app.views.purchaseOrders.Show', app.views.purchaseOrders.Show);


I render that component from a controller show function:



show : function(options) {
console.log("purchaseOrders controller show: options:", options);
var view = this.showView;

if (!view) {
this.showView = this.render({
xtype : 'app.views.purchaseOrders.Show'
}, Ext.getBody());
view = this.showView;
}
view.setPurchaseOrder(options.instance);
view.show();
},


All params, vars and arguments I send thru are valid. I debugged every little peace.


Thanks a lot for your help!


Flo

mikih
14 Jan 2011, 6:52 AM
I found the issue!

There is no hideHandler function anymore....



dockedItems : [
{
xtype : 'button',
text : 'Reject',
ui : 'action',
dock : 'bottom',
listeners : {
tap : this.hideHandler
}
}, {
xtype : 'button',
text : 'Approve',
ui : 'action',
dock : 'bottom',
listeners : {
tap : this.hideHandler
}
}
]



sorry guys, I am to much used to java or flex exceptions... that are much more supportive

tysoncadenhead
2 Jun 2011, 6:39 PM
I had this issue after switching from an earlier release. It turned out that it went away when I took out scroll: 'vertical' from my panel object. I'm guessing that has been deprecated.

gauravtoshniwal
13 Sep 2011, 8:16 AM
I'm getting similar error, even with the code that I have downloaded from the github repo for the example "Intro to the Nested List Component"
TypeError: Result of expression 'c' [undefined] is not an object

gauravtoshniwal
13 Sep 2011, 8:36 AM
So I've kinda got a workaround:
I define my json data as a variable , say "data" in the treestore component, and pass it as the value of parameter "root" ... so it looks like


var data = {json};
NestedListDemo.music_store = new Ext.data.TreeStore({ model: 'ListItem',
root: data,
proxy: {
type: 'ajax',
url: '/data/tracks.json',
reader: {
type: 'tree',
root: 'items'
}
}
});