添加形式在煎茶触摸时间轴对象
问题描述:
我已经从煎茶触摸API添加形式在煎茶触摸时间轴对象
var form = new Ext.form.FormPanel({
items: [
{
xtype: 'textfield',
name : 'first',
label: 'First name'
},
{
xtype: 'textfield',
name : 'last',
label: 'Last name'
},
{
xtype: 'numberfield',
name : 'age',
label: 'Age'
},
{
xtype: 'urlfield',
name : 'url',
label: 'Website'
}
]
});
采取的形式示例和我已经创建使用
timeline = new Ext.Component({
title: 'Loan Details',
cls: 'timeline',
scroll: 'vertical',
tpl: ['<div></div>']
});
时间轴对象,然后加入时间轴到面板为:
panel = new Ext.TabPanel({
fullscreen: true,
cardSwitchAnimation: 'slide',
ui: 'light',
items: [timeline]
});
如何将表单对象添加到时间轴?就像我能如何证明这一点?我应该在哪里添加它?
感谢您提前回复。
答
我不确定你在做什么。你是否想要有一种连续的旋转木马,你将放置FormPanel? 如果是这样,你应该扩展Ext.Panel来创建时间轴对象,然后作为item使用xtype:'fieldset'并且在那里有表单项。
例如:
App.views.Timeline = Ext.extend(Ext.Panel, {
initComponent: function() {
Ext.apply(this, {
title: 'Loan Details',
cls: 'timeline',
scroll: 'vertical',
items:[
{
xtype: 'fieldset',
defaults: {
labelAlign: 'left',
labelWidth: 'auto',
}
items: [
{
xtype: 'textfield',
name : 'first',
label: 'First name'
},
{
xtype: 'textfield',
name : 'last',
label: 'Last name'
},
{
xtype: 'numberfield',
name : 'age',
label: 'Age'
},
{
xtype: 'urlfield',
name : 'url',
label: 'Website'
}
]
}
]
});
}});
的Ext.Component是用于通过数据属性表示的数据。根据您提供的模板即tpl属性显示数据,但您需要指定要显示的对象的属性。例如tpl:<div>{text}</div>
和data:[{text:'Example'}]
我试图把一个形式在时间轴上有一个文本框和一个提交按钮,当提交按钮被点击,我想JSONP要求更改参数,并得到新的内容,这要归功于Ilija139在另一个问题,我知道如何更改jsonp请求的参数,但努力将表单元素附加到GeoTweets应用程序中的时间轴组件:http://dev.sencha.com/deploy/touch/getting-started.html#DetailedSteps –
正如我所说的Ext.Component仅用于显示静态数据,您必须使用Ext.Panel来附加一个表单元素。还可以停靠FormPanel中这样'变种面板=新Ext.TabPanel({ 全屏:真, cardSwitchAnimation: '幻灯片', 项目:[地图,时间表], dockedItems:[表] });'并在表单对象中包含'dock:'top''属性 – ilija139