Я работаю в рамках Sencha Touch и хочу создать панель навигации, чтобы подтолкнуть мои дополнительные виды. Тем не менее, я хочу добавить либо мой cardlayout
(например: xtype: 'mycard'
), либо виджет (например: xtype: 'my'
). Как я могу нажать существующий вид, который уже определен как Ext.define('MyProject.view.my', {//some deination})
. Я попробовал следующий код, но не смог вызвать функцию handler
, когда кнопка нажата в панели навигации. Я абсолютно не могу push
любой вид, поскольку он не работает в моей handler
функции, и не может позвонить view.push
. Как я могу получить свое представление и нажать в качестве элемента навигации?push view navigation Sencha Touch
Попробовал код для толчка некоторого вида:
//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'
}
}
Что означает «нажать вид»? Ваш вопрос для меня не имеет смысла. –