我已經使用Sencha touch實現了一個功能。SENCHA:如何通過單擊SENCHA touch中的ADD/DELETE按鈕動態地添加/刪除文本字段
因爲我設計了一個帶有2個按鈕的視圖在VIEW中的文件中添加,刪除。
AQnd添加相應控制器在控制器的文件按鈕
控制器工作正常控制檯出把
,但我需要添加任何一種形式像場的文本框或文本區域設置,通過錄制ADD按鈕動態
刪除一個表格當點擊刪除按鈕動態。
查看文件:
Ext.define('MyApp.view.MainPanel', {
extend: 'Ext.form.Panel',
config: {
items: [
{
xtype: 'button',
id: 'addButton',
height: 33,
left: '',
margin: '500px',
padding: '',
right: '400px',
ui: 'confirm-round',
width: 100,
text: 'Add'
},
{
xtype: 'button',
id: 'deleteButton',
height: 33,
margin: '500px',
right: '296px',
ui: 'decline-round',
width: 100,
text: 'Delete'
}
]
}});
Controller文件:
Ext.define('MyApp.controller.MainController', {
extend: 'Ext.app.Controller',
config: {
views: [
'MainPanel'
],
},
init: function() {
this.control({
'#addButton': {
tap: function() {
console.log('Add field');
}
},
'#deleteButton': {
tap: function() {
console.log('Delete field');
}
},
});
},
輸出: