PDA

View Full Version : Whats wrong with my view declaration?



jiewmeng
21 May 2012, 7:41 PM
I am getting "Uncaught TypeError: Cannot call method 'substring' of undefined"

/app/view/Sidebar.js


Ext.define('SimpleTodo.view.Sidebar', {
extend: 'Ext.panel.Panel',
config: {
xtype: 'sidebar',
title: 'Projects & Todo Lists',
/*tbar: [
{
xtype: 'button',
text: 'Add Project'
},
{
xtype: 'button',
text: 'Add Todo List'
}
],*/
//store: Ext.data.StoreManager.lookup('projects'),
html: 'Hello world',
width: 200
}
});


app.js


Ext.application({
name: 'SimpleTodo',
views: [
'Sidebar'
], ...
launch: function() { Ext.create('Ext.container.Viewport', {
layout: {
type: 'hbox',
pack: 'start',
align: 'stretch'
},
items: [
{
xtype: 'sidebar' // < ----- heres the problem I think
},
{
xtype: 'panel',
id: 'detailsView',
flex: 1,
layout: 'card',
items: [
{
xtype: 'panel',
id: 'todoDetails',
title: 'Todo Details'
},
{
xtype: 'panel',
id: 'addProject',
title: 'Add project',
}
]
}
]
})
}

debabrata
21 May 2012, 10:46 PM
Put xtype,tile,width out of config. I am curious Why have put that in the config. By the way declaring xtype like this is not the recommended way. Use alias.

jiewmeng
21 May 2012, 11:43 PM
Thanks, that works, but how do I know that? Looking at the docs, xtype, title, width are in the config?

debabrata
22 May 2012, 8:51 PM
Just look at this
http://docs.sencha.com/ext-js/4-1/#!/guide/application_architecture (http://localhost/4/docs/index.html#!/guide/application_architecture)