PDA

View Full Version : Panel xtype items problem



JFFortierQc
6 Oct 2011, 9:08 AM
Hi
Weird problem. I follow a tutorial to learn Sencha. Yesterday night, before I close my computer everything displayed properly in Safari and Chrome on Mac. This morning, I just open the computer, start the HTML page and in Safari there is a JavaScript Error Message. Chrome is ok.

So here is the error I get when I run it in Safari
sencha-touch.js:6 TypeError: 'null' is not an object (evaluating 'a[b]')

I test it and try to find where that can comes from and found that in a function I have this code :


return {
xtype: 'panel',
width: 220,
dock: 'left',
layout: 'fit',
style: 'border-right: 1px solid;',
items: [{
xtype: 'ContactList',
listeners: {
scope: this,
itemtap: this.onContactListItemTap,
itemswipe: this.onContactListItemSwipe
}
}
],
dockedItems: [{
xtype: 'toolbar',
dock: 'top',
title: 'Contacts'
}
]

};


In that code, if I comment the xtype: 'ContactList', the error is gone. Ok, the list does not display, but it make me think that the error can be in the file where the ContactList is. So, this file code is this :


MahLeaApp.ContactList = Ext.extend(Ext.List,
{
/*------------------------------
* Parameters list
------------------------------*/
store: Ext.StoreMgr.get('ContactStore'),
itemTpl: '{lastName}, {firstName}',
emptyText: 'No contacts defined.',
allowDeselect: false,

/*------------------------------
* Action Methods declaration
------------------------------*/
onRender: function() {
MahLeaApp.ContactList.superclass.onRender.apply(this, arguments);
this.store.load();
}
}
);

/*------------------------------
* Class Registration
------------------------------*/
Ext.reg('ContactList', MahLeaApp.ContactList);


Does anybody knows what can cause this?
Thanks

JFFortierQc
6 Oct 2011, 9:37 AM
I've test more deeper, I found that when comments the this.store.load(); line of code in the ContactList, the bugs is not there. So I think the bug could be there.


/*------------------------------
* Class Definition
------------------------------*/
Ext.regModel('ContactModel', {
/*------------------------------
* Parameters list
------------------------------*/
proxy: {
type: 'localstorage',
id: 'contactModel'
},
fields: [
'id',
'firstName',
'lastName',
'street',
'city',
'state',
'zip',
'phone'
]
}
);


/*------------------------------
* Class Registration
------------------------------*/
Ext.regStore({
model: 'ContactModel',
storeId: 'ContactStore'
}
);


Can't find it now, but still on it. So if someone know the answer, let me know.

JFFortierQc
6 Oct 2011, 6:02 PM
More info :
Bugs on iOS 4.3 (iPad and iPhone)
But works fine on iOS 4.2 and less (iPhone and iPad)

Any idea:((