Sencha touch 显示嵌套列表中的旋转木马-可能使用处理程序?
我有一个嵌套列表-当我到达最后一项时,我想调用一个处理程序,将面板交换到旋转木马。请参阅- 不幸的是,我似乎无法让任何处理程序处理嵌套项,也无法想出其他方法。我仍然是Sencha的初学者,因此任何帮助都将不胜感激。 谢谢大家! 见代码:Sencha touch 显示嵌套列表中的旋转木马-可能使用处理程序?,sencha-touch,Sencha Touch,我有一个嵌套列表-当我到达最后一项时,我想调用一个处理程序,将面板交换到旋转木马。请参阅- 不幸的是,我似乎无法让任何处理程序处理嵌套项,也无法想出其他方法。我仍然是Sencha的初学者,因此任何帮助都将不胜感激。 谢谢大家! 见代码: Ext.setup({ icon: 'icon.png', tabletStartupScreen: 'tablet_startup.png', phoneStartupScreen: 'phone_startup.png', glossOnIcon: true
Ext.setup({
icon: 'icon.png',
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
glossOnIcon: true,
onReady: function() {
/*Data Store
*********************************************************************************/
var data = {
text: 'Categories',
items: [{
text: 'Core Skills/Personal Development',
items: [{
text: 'Fishbone Diagram',
leaf: true
},{
text: '5 Whys Technique',
leaf: true
},{
text: 'SMART Objectives',
leaf: true
},{
text: 'Circle of Influence',
leaf: true
},{
text: 'Managing Stress',
leaf: true
}]
},{
text: 'Communication',
items: [{
text: 'Listening Skills',
leaf: true
},{
text: 'Giving Feedback',
leaf: true
},{
text: 'Recieving Feedback',
leaf: true
}]
},{
text: 'Customer Service',
items: [{
text: 'Listening and Confirming',
leaf: true
}]
}]
};
Ext.regModel('ListItem', {
fields: [{name: 'text', type: 'string'}]
});
var store = new Ext.data.TreeStore({
model: 'ListItem',
root: data,
proxy: {
type: 'ajax',
reader: {
type: 'tree',
root: 'items'
}
}
});
var nestedList = new Ext.NestedList({
fullscreen: true,
title: 'Categories',
displayField: 'text',
dock: 'top',
store: store
});
/*Carousel
*********************************************************************************/
var carousel = new Ext.Carousel({
fullscreen: true,
displayField: 'text',
dock: 'top',
defaults: {
cls: 'card'
},
items: [{
html: '<img src="drainImage1.png">'
},
{
title: 'Tab 2',
html: '<img src="drainImage2.png">'
}]
});
/*Tab Panel
*********************************************************************************/
var tabpanel = new Ext.TabPanel({
tabBar: {
dock: 'bottom',
layout: {
pack: 'center'
}
},
fullscreen: true,
ui: 'light',
cardSwitchAnimation: {
type: 'slide',
cover: true
},
defaults: {
scroll: 'vertical'
},
items: [{
title: 'My Courses',
html: '<h1>Course list to appear here</h1>',
iconCls: 'favorites',
cls: 'card2',
badgeText: '3',
dockedItems: nestedList
},{
title: 'Sample',
cls: 'card2',
iconCls: 'user',
dockedItems: carousel
},{
title: 'Help',
html: '<h1>Help</h1><p>Info on how to add to your home screen goes here</p>',
cls: 'card3',
iconCls: 'user'
}]
});
Ext.setup({
图标:“icon.png”,
TabletStartup屏幕:“tablet_startup.png”,
phoneStartupScreen:'phone_startup.png',
格洛松尼康:没错,
onReady:function(){
/*数据存储
*********************************************************************************/
风险值数据={
文本:“类别”,
项目:[{
正文:“核心技能/个人发展”,
项目:[{
文本:“鱼骨图”,
叶:是的
},{
文字:“5个为什么的技巧”,
叶:是的
},{
正文:“智能目标”,
叶:是的
},{
文本:“影响圈”,
叶:是的
},{
文本:“管理压力”,
叶:是的
}]
},{
文本:“通信”,
项目:[{
课文:“听力技巧”,
叶:是的
},{
文本:“给予反馈”,
叶:是的
},{
文本:“接收反馈”,
叶:是的
}]
},{
文本:“客户服务”,
项目:[{
文本:“倾听并确认”,
叶:是的
}]
}]
};
Ext.regModel('ListItem'{
字段:[{name:'text',type:'string'}]
});
var store=new Ext.data.TreeStore({
模型:“ListItem”,
根:数据,
代理:{
键入:“ajax”,
读者:{
键入:“树”,
root:'项目'
}
}
});
var nestedList=new Ext.nestedList({
全屏:对,
标题:“类别”,
显示字段:“文本”,
码头:“顶部”,
商店:商店
});
/*旋转木马
*********************************************************************************/
var转盘=新的外部转盘({
全屏:对,
显示字段:“文本”,
码头:“顶部”,
默认值:{
cls:“卡”
},
项目:[{
html:'
},
{
标题:“表2”,
html:'
}]
});
/*选项卡面板
*********************************************************************************/
var tabpanel=新的Ext.tabpanel({
选项卡栏:{
船坞:“底部”,
布局:{
包装:'中心'
}
},
全屏:对,
ui:“轻”,
CardSwitch动画:{
键入:“幻灯片”,
封面:对
},
默认值:{
滚动:“垂直”
},
项目:[{
标题:“我的课程”,
html:“要显示在此处的课程列表”,
iconCls:“收藏夹”,
cls:“card2”,
正文:“3”,
dockedItems:嵌套列表
},{
标题:“样本”,
cls:“card2”,
iconCls:'用户',
dockedItems:旋转木马
},{
标题:“帮助”,
html:“帮助有关如何添加到主屏幕的信息,请参见此处”,
cls:“card3”,
iconCls:'用户'
}]
});
从Sencha嵌套列表中检查此样本
有一个“leafitemtap”事件,您可以将其挂接到嵌套列表以执行回调:
nestedList.on('leafitemtap', function(subList, subIdx, el, e, detailCard) {
var ds = subList.getStore(),
r = ds.getAt(subIdx);
Ext.Ajax.request({
url: '../../src/' + r.get('id'),
success: function(response) {
detailCard.setValue(response.responseText);
},
failure: function() {
detailCard.setValue("Loading failed.");
}
});
});