-
14 Oct 2010 7:15 AM #1
undefined error in 0.97
undefined error in 0.97
I have a simple list screen which acts as a menu - calls card panels defined in the main layout, ie
Above this in the .js file is the code for menuPage which does main.setCard (<panel id>). In 0.96 this worked Ok, now in 0.97 the 'main' variable is coming up as undefined and the setcard fails.Code:var main = new Ext.Panel({ fullscreen: true, layout: 'card', items:[menuPage, timeline, detail, items, item_detail,todo,years,searchPanel] }).show();
Any ideas?Code:var menuPage = new Ext.List({ id: 'menuPage', dockedItems: [{ id: 'status', xtype: 'toolbar', dock: 'top', title: "CollectGBStamps" } ], tpl: menuTemplate, itemSelector: 'div.menudetail', singleSelect: true, grouped: false, indexBar: false, emptyText : '<p style="padding: 10px">No menu items found!</p>', store: menuStore, listeners: { itemtap: function(view, index, item, e){ var rec = view.store.getAt(index); var nextpanel = rec.get('optionPanel'); if (nextpanel == 'timeline') { timeline_title = "2010 Issues"; Ext.getCmp('timeline_toolbar').setTitle ("2010 Issues"); issuesStore.read({ params: { parm: '2010' } }); } if (nextpanel == 'years') { yearsStore.read(); yearsStore.sort('setyear' , 'DESC'); } if (nextpanel == 'searchPanel') { searchStore.read({ params: { parm: 'bridge' } }); } if (nextpanel == 'todo') { //alert(Ext.version); } alert('going to ' + nextpanel); console.log(main); main.setCard(nextpanel); } } });
Thanks
Robert
-
14 Oct 2010 3:05 PM #2
Well, assuming
a) That var main = ... is wrapped in an onReady block
b) The second set of code is in another file
I can see exactly why it would say main is not defined.
Some other file:Code:Ext.setup({ onReady: function(){ var x = 1; //local to the onReady scope } });
Code:setTimeout(function(){ console.log(x); // undefined }, 1000);Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
15 Oct 2010 12:23 AM #3
The code snippets in the examples are in the same file and are both within the onReady function.
Switching to 0.96 libraries and this works OK.
Once again moving to a new version of Sencha Touch breaks something that worked before - with no obvious reason for doing so that I can see. It is very frustrating.
Robert
-
16 Oct 2010 1:09 PM #4
Hi,
This seems to work again if I remove the .show() call from the main card panel.
Robert
Similar Threads
-
about 'this.data is undefined' error
By pirusira in forum Ext 3.x: Help & DiscussionReplies: 1Last Post: 3 May 2010, 12:19 AM -
Record is undefined error
By ajanthanr in forum Ext 3.x: Help & DiscussionReplies: 2Last Post: 8 Jul 2009, 7:49 AM -
Error: combo is undefined
By Rafael in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 18 Apr 2009, 9:53 AM -
weird error : sp is undefined
By nbize in forum Ext 2.x: Help & DiscussionReplies: 3Last Post: 9 Mar 2009, 8:36 AM


Reply With Quote