我在煎茶触摸2在我所创建的容器内的一些自定义按钮煎茶上的按钮
Ext.define('ov_app.view.Main', {
extend: 'Ext.Container',
requires:[
'ov_app.view.Eligibelity',
],
xtype: 'main',
css:[{
"path": "default-theme.css",
}],
config:{
scrollable: true,
items: [
{ xtype: 'panel',
margin:10,
items:[
{
xtype:'button',
margin: '0 0 8 0',
cls:"main_navigation",
style:'background-color:#000',
action: 'push-view',
},{
xtype:'button',
margin: '0 0 8 0',
cls:"main_navigation",
},{
xtype:'button',
cls:"main_navigation",
}
]
}]
}
});
thees按钮创建的索引页的标签显示不同的视图看起来像这样
点击橙色按钮我想显示一个新的视图。
我已经试过ext.Navigation视图,但它不是我想要的。 我是不是要一个事件侦听器添加到按钮或我必须做别的事情认罪建议
我已经创造了控制器文件夹的新控制器main.js
Ext.define('ov_app.controller.Main', {
extend: 'Ext.app.Controller',
config:{
control: {
'button[action=push-view]': {
tap: 'pushViewFunction'
}
},
},
pushViewFunction: function() {
Ext.Viewport.add({
xtype: 'Eligibelity'
});
}
});
和我的新观点Eligibelity。 js代码
`
Ext.define('ov_app.view.Eligibelity', {
xtype : 'Eligibelity',
config: {
layout: 'vbox',
cls: 'big',
items: [
{
xtype: 'title',
title: 'Twitter Search'
}
]
}
});
` 也是我app.js代码
` Ext.Loader.s etPath({'touch'/'src', 'ov_app':'app' });
Ext.application({
name: 'ov_app',
requires: [
'Ext.MessageBox'
],
views: ['Main', 'Eligibelity'],
controllers: ['Main'],
launch: function() {
// Destroy the #appLoadingIndicator element
Ext.fly('appLoadingIndicator').destroy();
// Initialize the main view
Ext.Viewport.add(Ext.create('ov_app.view.Main'));
},
onUpdated: function() {
Ext.Msg.confirm(
"Application Update",
"This application has just successfully been updated to the latest version. Reload now?",
function(buttonId) {
if (buttonId === 'yes') {
window.location.reload();
}
}
);
}
});
`
仍然不工作,不知道为什么。所以我创建了一个新的控制器和视图,并且我在上面的问题中放置了代码。 – 2013-04-23 08:16:55
@AbhimanueTamang你有没有在'app.js'中引用你的视图和控制器? – Eli 2013-04-23 08:19:56
是的,我也上传了我的问题在上面的app.js代码,但仍然不工作 – 2013-04-23 08:30:03