Sencha touch 2 在Sencha Touch 2.0的外部列表中选择行时,如何推动外部面板?
给定一个简单的Ext.列表,如Sencha文档中的列表,当我单击其中一个名称时,如何使新面板或旋转木马“推”到屏幕上Sencha touch 2 在Sencha Touch 2.0的外部列表中选择行时,如何推动外部面板?,sencha-touch-2,Sencha Touch 2,给定一个简单的Ext.列表,如Sencha文档中的列表,当我单击其中一个名称时,如何使新面板或旋转木马“推”到屏幕上 我希望能够有一个按钮导航回主屏幕。您可以使用。下面是一个非常简单的应用程序,演示了这一点: Ext.setup({ // onReady is when we can start building our application onReady: function() { // Create the view by just adding a c
我希望能够有一个按钮导航回主屏幕。您可以使用。下面是一个非常简单的应用程序,演示了这一点:
Ext.setup({
// onReady is when we can start building our application
onReady: function() {
// Create the view by just adding a config block into Ext.Viewport.
// We give it a reference of `view` so we can use it later
var view = Ext.Viewport.add({
// Give it an xtype of `navigationview` so it knows to create a NavigaitonView
xtype: 'navigationview',
// Define the list as its only item
items: [
{
xtype: 'list',
// Give it a title so the navigation view will show it
title: 'List',
// `itemTpl` is the template for each item in the list. We are going to create a store
// with a bunch of records, which each have a field called `name`, so we use that in our
// template
itemTpl: '{name}',
// Define our store
store: {
// Define the fields that our store will have
fields: ['name'],
// And give it some data for each record.
data: [
{ name: 'one' },
{ name: 'two' },
{ name: 'three' }
]
},
// Now we add a listener for the `itemtap` event, which is fired when a user taps on an item
// in this list. This event is passed various arguments in the signature, but we only need the
// record
listeners: {
itemtap: function(list, index, target, record) {
// now we have the record from the store, which was tapped. we now want to push a new view into
// the navigaitonview
view.push({
// Give it an xtype of panel
xtype: 'panel',
// Set the title to the name field of the record
title: record.get('name'),
// And add some random html
html: 'This is my pushed view!'
})
}
}
}
]
});
}
});
我添加了内联注释,以便您知道发生了什么
我还建议您在上提问,因为您可能会收到更快的响应。您需要将选择侦听器添加到列表对象,然后在侦听器功能中,您可以确定单击了什么记录,并执行操作调用。。。你应该看看jog with friends应用程序,看看如何在新的类系统中正确地利用视图。谢谢你的打字错误修复。我写这篇文章时睡了一半