我有一个由文本框,按钮和ListView组成的面板。我相信除了列表之外,我的设置正确。 Listview不会显示来自商店的数据。请帮忙我想添加如下:
Ext.define('Abc.view.Trains', {
extend: 'Ext.Panel',
xtype:'searchtrains',
requires: [ 'Ext.dataview.List','Ext.Label','Ext.form.FieldSet'
'Abc.view.SearchTrainResults','Abc.view.SampleList'],
config: {
title: 'Train Enquiry',
items: [
{
xtype: 'fieldset',
style:'width:74%; float:left',
margin:'10px',
items:
{
xtype: 'textfield',
placeHolder: 'Username',
itemId: 'trainNoTextField',
name: 'trainNoTextField',
required: true
}
},
{
xtype: 'button',
itemId: 'trainSearchButton',
ui: 'action',
padding: '10px',
text: 'Go',
style:'width:20%; margin-top:10px; float:right'
},
{
xtype: 'sampList',
}
]
]};
ABC /视图/ SampleList
Ext.define('Abc.view.SampleList', {
extend: 'Ext.List',
xtype: 'sampList',
requires: ['TrainEnquiry.store.SampleList'],
config: {
title: 'Train Enquiry',
itemTpl: '<div class="myContent">'+
'<div><b>{status}</b> </div>' +
'</div>',
store: 'SampleList',
},
});
ABC /存储/ SampleList
Ext.define('Abc.store.SampleList', {
extend: 'Ext.data.Store',
config: {
fields: ['status'],
data: [
{ status: "Live! Train Statusjhgkbvdsbvfbnsdfvsdgfjasdgjhagsdhjasgdahjsgdjhasdbahjsgdsajhdgahjsgdashdgajhsdgajhsdvahjsdg" },
{ status: "Live! Station Statustusjhgkbvdsbvfbnsdfvsdgfjasdgjhagsdhjasgdahjsgdjhasdbahjsgdsajhdgahjsgdashdgajhsdgajhsdvahjsdg" },
{ status: "Train Time Tabletusjhgkbvdsbvfbnsdfvsdgfjasdgjhagsdhjasgdahjsgdjhasdbahjsgdsajhdgahjsgdashdgajhsdgajhsdvahjsdg"}
]
}
});
答案 0 :(得分:0)
如果您刚刚复制了代码,那可能是因为您忘了在'Ext.form.FieldSet'之后添加昏迷
requires: [ 'Ext.dataview.List','Ext.Label','Ext.form.FieldSet'
'Abc.view.SearchTrainResults','Abc.view.SampleList'],
我厌倦了以下内容,它对我有用:
视图\ Trains.js
Ext.define('Abc.view.Trains', {
extend: 'Ext.Panel',
xtype:'searchtrains',
requires: ['Ext.dataview.List','Ext.Label','Ext.form.FieldSet','Abc.view.SampleList'],
config: {
title: 'Train Enquiry',
layout:'vbox',
items: [
{
flex:1,
xtype: 'fieldset',
style:'width:74%; float:left',
margin:'10px',
items:
{
xtype: 'textfield',
placeHolder: 'Username',
itemId: 'trainNoTextField',
name: 'trainNoTextField',
required: true
}
},
{
flex:1,
xtype: 'button',
itemId: 'trainSearchButton',
ui: 'action',
padding: '10px',
text: 'Go',
style:'width:20%; margin-top:10px; float:right'
},
{
flex:1,
xtype: 'sampList',
}
]}
});
视图\ SampleList.js
Ext.define('Abc.view.SampleList', {
extend: 'Ext.List',
xtype: 'sampList',
requires: ['Abc.store.SampleList'],
config: {
title: 'Train Enquiry',
itemTpl: '<div class="myContent">'+
'<div><b>{status}</b> </div>' +
'</div>',
store: 'SampleList',
},
});
存储\ SampleList.js
Ext.define('Abc.store.SampleList', {
extend: 'Ext.data.Store',
config: {
fields: ['status'],
data: [
{ status: "Live! Train Statusjhgkbvdsbvfbnsdfvsdgfjasdgjhagsdhjasgdahjsgdjhasdbahjsgdsajhdgahjsgdashdgajhsdgajhsdvahjsdg" },
{ status: "Live! Station Statustusjhgkbvdsbvfbnsdfvsdgfjasdgjhagsdhjasgdahjsgdjhasdbahjsgdsajhdgahjsgdashdgajhsdgajhsdvahjsdg" },
{ status: "Train Time Tabletusjhgkbvdsbvfbnsdfvsdgfjasdgjhagsdhjasgdahjsgdjhasdbahjsgdsajhdgahjsgdashdgajhsdgajhsdvahjsdg"}
]}
});
的index.html
<html>
<head>
<link href="sencha-touch.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="sencha-touch-all-debug.js"></script>
<link rel="stylesheet" href="resources/css/app.css" type="text/css">
</head>
<body>
<script type="text/javascript">
Ext.application(
{
name: 'Abc',
views: ['Trains','SampleList'],
stores:['SampleList'],
launch: function()
{
Ext.Viewport.add(Ext.create('Abc.view.Trains'));
}
});
</script>
</body>
</html>
答案 1 :(得分:0)
这样的东西?
Ext.define('Abc.view.Trains', {
extend: 'Ext.Panel',
xtype:'searchtrains',
requires: ['Ext.dataview.List','Ext.Label','Ext.form.FieldSet','Abc.view.SampleList'],
config: {
title: 'Train Enquiry',
layout:'vbox',
items: [
{
flex:1,
xtype:'panel',
layout:'hbox',
items:[{
flex:2,
xtype: 'fieldset',
style:'width:74%; float:left',
margin:'10px',
items:
{
xtype: 'textfield',
placeHolder: 'Username',
itemId: 'trainNoTextField',
name: 'trainNoTextField',
required: true
}
},{
flex:1,
xtype: 'button',
itemId: 'trainSearchButton',
ui: 'action',
padding: '10px',
text: 'Go',
style:'width:20%; margin-top:10px; float:right'
}]
},{
flex:10,
xtype: 'sampList',
}]
}
});