Я пытаюсь загрузить List
в Panel
, но я получаю следующее сообщение об ошибкесписок не загружается в панели в сенче прикосновении
Uncaught TypeError: Cannot call method 'substring' of undefined
вот мой ProfileContainer.js
, который содержит List
Ext.define('demo.view.ProfileContainer', {
extend: 'Ext.Panel',
xtype: 'profilecontainer',
// requires: [ 'Ext.TitleBar', 'demo.view.ProfileList' ],
requires: [ 'Ext.TitleBar' ],
config: {
items: [{
xtype: 'titlebar',
title: 'demo',
cls: 'bms-bg'
}, {
xtype: 'profilelist'
}]
}
});
- код ProfileList.js
Ext.define('demo.view.ProfileList', {
extend: 'Ext.dataview.List',
alias: 'widget.profilelist',
requires: ['demo.store.ProfileStore'],
config: {
store: 'ProfileStore',
itemTpl: '{name}',
}
});
вот мой ProfileStore.js
Ext.define('demo.store.ProfileStore',{
extend:'Ext.data.Store',
config: {
model: 'demo.model.ProfileModel',
data:[
{ name: 'John Rambo' },
{ name: 'Brad Pitt'}
]
}
});
и ProfileModel.js
Ext.define('demo.model.ProfileModel', {
extend: 'Ext.data.Model',
config: {
fields: [
{ name: 'name', type: 'string' }
]
}
});
, но мой список разве загрузка в панель и я получаю выше упомянутой ошибки
Я определил 'alias: 'widget.profilelist'' в' ProfileList.js', и я использую его как 'xtype:' profilelist'' в' ProfileContainer.js', но все равно получаю ту же ошибку – Hunt
@Hunt please расширьте свой вопрос новыми фрагментами кода. – sra
@sra На самом деле все, что вам нужно в ST2, это 'xtype: 'my-xtype'', он работает так же, как' alias:' widget.my-xtype'' делает в ExtJS 4. – kevhender