我在網絡編程經驗僅限於中間,自學成才的JS和jQuery用PHP的衝刺。 ExtJS變成了一個完全不同的動物。使用控制器附加活動(煎茶觸摸/ ExtJS的)
我想不通爲什麼我的控制器沒有做什麼我期望,尤其是因爲我下面是本文檔中使用的語法(這是越來越沒用,因爲他們沒有描述什麼是實際發生的在例子中......但我離題了)。
Main.js
Ext.define("cs.view.Main", {
extend: 'Ext.TabPanel',
tabBarPosition: 'bottom',
requires: [
'cs.view.form',
'cs.view.location',
'Ext.TitleBar',
'cs.controller.geolocate'
],
config: {
tabBar: {
docked: 'bottom',
},
defaults: {
flex: 1
},
items: [
{ xtype: 'form' },
{ xtype: 'location' }
]
},
});
form.js
Ext.define('cs.view.form', {
extend: 'Ext.form.Panel',
requires: 'cs.controller.geolocate',
id: 'ClientFinderForm',
config: {
title: 'Home',
iconCls: 'home',
items: [
{
xtype: 'toolbar',
docked: 'top',
title: 'Client Finder'
},
{
xtype: 'textfield',
name: 'address',
label: 'address'
},
{
xtype: 'textfield',
name: 'dist',
label: 'distance(mi)'
},
{
xtype: 'button',
ui: 'confirm',
text: 'submit',
id: 'submitButton',
}
]
},
});
geolocate.js
Ext.define('cs.controller.geolocate', {
extend: 'Ext.app.Controller',
config: {
control: {
aButton: {
tap: 'message'
}
},//control
refs: {
aButton: '#submitButton'
},//refs
},//config
message: function(){
Ext.Msg.alert("Success", "Finally!");
}
});
發生了什麼?你的意思是「不按預期加工」?再清楚不過了,我會幫你 – 2012-04-11 15:44:40
沒有發揮它什麼都不做。我可以通過在form.js中添加'listeners:'來直接添加一個事件 – andyjv 2012-04-11 17:42:06
有一個答案在今天早些時候看起來很有幫助,但它似乎已經消失了......有關將一個'init:'添加到geolocate.js – andyjv 2012-04-11 17:43:01