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

阅读更多

代码:

 

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 '
后退{name}dsfdsffsds
'; }, getItemTextTpl: function(node) { return '
{name}: {description}
'; } } }); } } ] } ] }); } });

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


转载于:https://my.oschina.net/fanyongqiang/blog/654447

你可能感兴趣的:(Sencha Touch NestList 如何载入tree结构的数据)