[英]Extjs view rendering issue,Uncaught TypeError: Cannot read property 'tooNarrow' of undefined
Hello I have thr following view and they worked well with Extjs 4.1 library but know I use 5.1 version and when I am trying use it, it is not rendering pproperly on doLayout() and show Uncaught TypeError: Cannot read property 'tooNarrow' of undefined. 您好我有以下视图,他们与Extjs 4.1库工作得很好,但知道我使用5.1版本,当我尝试使用它时,它不会在doLayout()上显示pproperly并显示Uncaught TypeError:无法读取属性'tooNarrow'的undefined 。 I am newbie in Extjs maybe in 5.1 library has different options that I dont know?Please help
我是Extjs的新手也许在5.1库中有不同的选项,我不知道?请帮忙
Fist I am trying to load PersonPanelView: 拳头我正在尝试加载PersonPanelView:
PersonPanelView: PersonPanelView:
Ext.define('Pandora.view.Person.PersonPanelView', {
extend: 'Ext.panel.Panel',
alias: 'widget.PersonPanel',
layout: 'hbox',
items:[
{
flex:1.8,
xtype:'PersonList',
height:'100%',
title:'List of persons'
},
{
flex:3,
height:'100%',
xtype:'panel',
id:'personProfileId',
autoScroll:true,
title:'Person profile',
//frame:true,
bodyStyle:{background: '#99bce8'}
}
]
});
PersonList: PersonList:
Ext.define('Pandora.view.Person.PersonListView', {
extend: 'Ext.grid.Panel',
alias: 'widget.PersonList',
layout: 'border',
title: 'Person',
store: 'Person.PersonStore',
autoScroll:true,
dockedItems:[
{
tbar:[
{ xtype:'button', text:'Add Person',name:'addPerson' },'-',
{ xtype:'button', text:'Edit Person',name:'editPerson' },'-',
{ xtype:'button', text:'Remove Person',name:'removePerson' },'-',
{ xtype:'button', text:'Add Conference',name:'addConference'},'-',
{ xtype:'button', text:'Add Event',name:'addEvent'}
]
}
],
columns: [
{ text: 'Login', dataIndex: 'login' , flex:1,align:'center'},//
{ text: 'Name', dataIndex: 'name', flex:1,align:'center'},
{ text: 'Surname', dataIndex: 'surname', flex:1,align:'center'},
]
});
PersonStore: PersonStore:
Ext.define('Pandora.store.Person.PersonStore', {
extend: 'Ext.data.Store',
model: 'Pandora.model.Person.PersonModel',
autoLoad:true,
proxy: {
type: 'ajax',
url: 'do/person/getAllPersons'
}
});
PersonModel: PersonModel:
Ext.define('Pandora.model.Person.PersonModel', {
extend: 'Ext.data.Model',
fields: [
'id',
'login',
'password',
'email',
'name',
'avatar',
'surname',
'relationship',
'phoneNumber',
'gender',
'country',
'city',
'school',
'university',
'persons',
'conferences',
'images',
'requests',
'followers',
{name:'posts',type:'auto'},
'dateOfBirth'
]
});
A few things you should do here: 你应该在这里做一些事情:
1 - Unless you really know what you are doing, you should not be changing the grid layout. 1 - 除非你真的知道自己在做什么,否则你不应该改变网格布局。 Remove the line where you set
layout: 'border'
and the error will go away. 删除设置
layout: 'border'
的行layout: 'border'
,错误将消失。
2 - The tbar
does not go inside the dockedItems config. 2 -
tbar
不会进入dockedItems配置。
3 - The autoScroll config is called scrollable now, and it is set to true by default. 3 - autoScroll配置现在称为可滚动,默认情况下设置为true。
This is what your Grid should look like: 这就是你的网格应该是这样的:
Ext.define('Pandora.view.Person.PersonListView', {
extend: 'Ext.grid.Panel',
alias: 'widget.PersonList',
title: 'Person',
store: Ext.create('Pandora.store.Person.PersonStore'),
tbar:[
{ xtype:'button', text:'Add Person',name:'addPerson' },'-',
{ xtype:'button', text:'Edit Person',name:'editPerson' },'-',
{ xtype:'button', text:'Remove Person',name:'removePerson' },'-',
{ xtype:'button', text:'Add Conference',name:'addConference'},'-',
{ xtype:'button', text:'Add Event',name:'addEvent'}
],
columns: [{
text: 'Login', dataIndex: 'login' , flex:1,align:'center'
},{
text: 'Name', dataIndex: 'name', flex:1,align:'center'
},{
text: 'Surname', dataIndex: 'surname', flex:1,align:'center'
}]
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.