您的位置:首页 > 其它

Sencha Touch NestList 如何载入tree结构的数据

2012-05-27 12:18 411 查看
代码:

Ext.application({
name: 'Sencha',

phoneStartupScreen: 'resources/loading/Homescreen.jpg',
tabletStartupScreen: 'resources/loading/Homescreen~ipad.jpg',

launch: function() {
//The whole app UI lives in this tab panel
Ext.Viewport.add({
xtype: 'tabpanel',
fullscreen: true,
tabBarPosition: 'bottom',

items: [
{

xtype: 'nestedlist',
title: 'Blog',
iconCls: 'star',
cls: 'blog',
//displayField: 'title',
//useTitleAsBackText: false,
//onItemDisclosure: true,

store: {
type: 'tree',

/* fields: ['title', 'link', 'author', 'contentSnippet', 'content', {
name: 'leaf',
defaultValue: true
}], */

fields: ['id', 'name', 'description', 'items'],

proxy: {
type: 'ajax',
url: 'resources/data/data.json',
reader: {
type: 'json',
rootProperty: 'items'
}
}
},

detailCard: {
xtype: 'panel',
scrollable: true,
styleHtmlContent: true
},

listeners: {
itemtap: function(nestedList, list, index, element, post) {
this.getDetailCard().setHtml(post.get('name'));
}
},

getTitleTextTpl: function() {
return '<div>后退{name}dsfdsffsds</div>';
},
getItemTextTpl: function(node) {
return '<div><strong>{name}:</strong> <em>{description}</em></div>';
}

}
});
}
}
]
}
]
});
}
});


原理为载入一个hasMany的json数据,list会自动的进行加载。



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: