我正在使用Sencha touch开发应用程序。我已经实现了一个滑动菜单,点击菜单我想导航到另一个视图。
这是我的控制器的代码:
Ext
.define(
'MyApp.controller.Home',
{
extend : 'Ext.app.Controller',
requires : [ "MyApp.view.MovieDetails",
"Ext.util.InputBlocker" ],
config : {
refs : {
main : 'mainmenuview',
loginView : 'loginview',
inprogress:'inprogress'
},
control : {
'movieslistview > toolbar > button' : {
tap : function() {
Ext.Viewport.toggleMenu("left");
}
},
getSlideLeftTransition : function() {
return {
type : 'slide',
direction : 'left'
};
},
'menu > button' : {
tap : function(btn) {
var me = this;
var newActiveItem = Ext.ComponentQuery
.query("movieslistview[menu="
+ btn.getMenu() + "]"), main = this
.getMain();
newActiveItem = newActiveItem.length > 0 ? newActiveItem[0]
: null;
if (newActiveItem) {
main.setActiveItem(newActiveItem);
Ext.Viewport.hideAllMenus();
if (btn.getMenu() == "inprogress") {
inprogress = me.getInprogress();
Ext.Viewport.animateActiveItem(inprogress, me.getSlideLeftTransition());
}
}
}
},
'moviedetails' : {
swipe : function(moviedetails, e) {
var target = Ext.fly(e.target);
if (target.findParent(
'.x-scroll-container', 10, true))
return;
if (e.direction === "up") {
moviedetails.hide();
}
}
},
'moviedetails > button[action="close"]' : {
tap : function(button) {
var details = button.up("moviedetails");
details.hide();
Ext.util.InputBlocker.unblockInputs();
}
},
'movieslistview > list' : {
itemtap : function(list, index, item, record,
event) {
this._movieDetails = this.getMovieDetails();
this._movieDetails.setRecord(record);
Ext.Viewport.add(this._movieDetails);
Ext.util.InputBlocker.blockInputs();
this._movieDetails.on({
show : {
fn : function() {
list.deselectAll(true);
},
scope : this,
single : true
}
});
this._movieDetails.show();
}
}
}
},
getMovieDetails : function() {
if (!this._movieDetails) {
this._movieDetails = Ext
.create("Ersal.view.MovieDetails");
}
return this._movieDetails;
}
});
问题在于:
if (btn.getMenu() == "inprogress") {
inprogress = me.getInprogress();
Ext.Viewport.animateActiveItem(inprogress, me
.getSlideLeftTransition());
}
我希望在“inprogress”菜单上显示“Inprogress.js”视图
谢谢