【发布时间】:2015-01-30 18:14:24
【问题描述】:
我正在使用 Sencha Touch 框架,并且想设计一个导航栏来推送我的附加视图。但是,我想添加我的cardlayout(例如:xtype: 'mycard')或小部件(例如:xtype: 'my')。
如何推送已定义为Ext.define('MyProject.view.my', {//some deination}) 的现有视图。我尝试了以下代码,但在导航栏中按下按钮时无法调用我的 handler 函数。
我绝对无法查看pushany 视图,因为它在我的handler 函数中不起作用,并且无法调用view.push。
如何获取视图并将其作为导航项推送?
尝试推送某些视图的代码:
//create the navigation view and add it into the Ext.Viewport
var view = Ext.Viewport.add({
xtype: 'navigationview',
//we only give it one item by default, which will be the only item in the 'stack' when it loads
items: [{
//items can have titles
title: 'Navigation View',
padding: 10,
//inside this first item we are going to add a button
items: [{
xtype: 'button',
text: 'Push another view!',
handler: function () {
//when someone taps this button, it will push another view into stack
view.push({
//this one also has a title
title: 'Second View',
padding: 10,
//once again, this view has one button
items: [{
xtype: 'button',
text: 'Pop this view!',
handler: function () {
//and when you press this button, it will pop the current view (this) out of the stack
view.pop();
}
}]
});
}
}]
}]
});
我的代码:
{
xtype: 'button',
text: 'btn',
id: 'btn1',
scope: this,
handler: function(b, e) {
//here I want to push my view named as xtype: 'my'
// my main viewport has the xtype: 'main' and alias: 'widget.mypanel'
}
}
【问题讨论】:
-
“推送视图”是什么意思?你的问题对我来说没有意义。
标签: extjs model-view-controller sencha-touch sencha-touch-2