0

我是 Sencha Touch 2 的新手,我在使用嵌套列表时遇到了麻烦:工具栏与后退按钮一起重复,所以在嵌套列表的末尾我有 3 个工具栏和 3 个后退按钮。我想原因是我为每个详细卡创建 Ext.nestedList , useToolbar:false 不能解决问题,因为我无法转到上一个列表。也许后退按钮需要被覆盖,但我不知道。任何帮助都会非常有用。这是代码的顶部:

    Ext.define('ListItem', {
    extend: 'Ext.data.Model',
    config: {
        fields: ['text'],
    },

});

var treeStore = Ext.create("Ext.NestedList", {

    fullscreen: true,
    tabBarPosition: 'bottom',

    title: 'Now-Yakutsk',
    iconCls: 'star',
    displayField: 'title',
    layout: 'card',

    store: {
        type: 'tree',
        id: 'ListCard',
        fields: [
            'title','code',
            {name: 'leaf', defaultValue: true}
        ],

        root: {
            leaf: false
        },

        proxy: {
            type: 'jsonp',
            url: 'http://now/catlist.php',
            reader: {
                type: 'json',
                rootProperty: 'cat'
            }
        }
    },                                                                      

    listeners: { 

                leafitemtap: function(nestedList, list, index, target, record) {

                    var treeStore2 = Ext.create("Ext.NestedList", {

                    fullscreen: true,
                    tabBarPosition: 'bottom',
                    //useToolbar:false,

                        //leaf: true ,
                        iconCls: 'star',
                        displayField: 'title',

                    store: {
                        type: 'tree',
                        id: 'detailCard',
                        fields: [
                            'title','code','link',
                            {name: 'leaf', defaultValue: true}
                        ],

                        root: {
                            leaf: false
                        },

                        proxy: {
                            type: 'jsonp',
                            url: 'http://now/catlist2.php',
                            reader: {
                                type: 'json',
                                rootProperty: 'cat'
                            }
                        }
                    },

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

                    listeners: {

                        leafitemtap: function(nestedList, list, index, target, record) {
                            var cin = Ext.create("Ext.NestedList", {
                                fullscreen: true,
                                tabBarPosition: 'bottom',
                                //useToolbar:false,
                                        //title: 'Blog',
                                        iconCls: 'star',
                                        displayField: 'list',

                                        store: {
                                            type: 'tree',

                                            fields: [
                                                'name', 'link', 'list', 'image', 'adress', 'banner',
                                                {name: 'leaf', defaultValue: true}
                                            ],

                                            root: {
                                                leaf: false
                                            },

                                            proxy: {
                                                type: 'jsonp',
                                                url: 'http://now/cinemalist.php',
                                                reader: {
                                                    type: 'json',
                                                    rootProperty: 'cinema'
                                                }
                                            }
                                        },

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

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


                            });

和截图:

http://piccy.info/view3/4985552/cdfd1dcca3928d4a5d4b4b41ba060b1f/

4

1 回答 1

1

找到解决方案,以防其他人遇到同样的问题 - 重点是隐藏并显示工具栏正在使用活动的非活动方法播放,例如在我们创建的父级中

                 listeners: {  activate : function() { 
                        //this.getToolbar().hide();
                        tb = this.getToolbar();

                         } ,
                         deactivate: function() {
                        //this.getToolbar().hide();                          


}

然后在孩子我们放

 listeners: {
                             activate : function() {         
                                                            tb1 = this.getToolbar();
                                                            tb1.hide();
                                                            tb.show(); 


                            //this.getToolbar().hide();

                             } ,
                             deactivate: function() {       
                                //tb.show(); 
                                //alert('dd');
                            //this.getToolbar().hide();                           

    }

等等 ...

于 2013-08-15T07:40:47.737 回答