1

嗨,我不明白为什么我在 tab3 中看不到我的列表...

在此处输入图像描述 这是我的代码...我在 myStore 中添加了一条记录,但我没有看到列表...

提前致谢!

    var mainForm ;
var mainFormPanel={};
var addToXml=function (values){};
var htmlTemplate='<p>{b}</p><p>{m}</p><p>{f}</p>';
var template = new Ext.Template(htmlTemplate);


var myStore = Ext.create('Ext.data.Store', {
    storeId: 'MyStore',
    fields: [
             {name: 'id', type: 'string'},
             {name: 'c', type: 'string'},
             {name: 'd', type: 'string'},
             {name: 'q', type: 'string'},
             {name: 'n', type: 'string'}
             ]
}); // create()
myStore.add({id:"id",c:"222",d:"333",q:"444",n:"555"});

var listpanel;

var config={
        glossOnIcon: false,
        autoMaximize: false,
        icon: {
            57: 'lib/sencha-touch/resources/icons/icon.png',
            72: 'lib/sencha-touch/resources/icons/icon@72.png',
            114: 'lib/sencha-touch/resources/icons/icon@2x.png',
            144: 'lib/sencha-touch/resources/icons/icon@114.png'
        },
        phoneStartupScreen: 'lib/sencha-touch/resources/loading/Homescreen.jpg',
        tabletStartupScreen: 'lib/sencha-touch/resources/loading/Homescreen~ipad.jpg',

        //next we require any components we are using in our application.
        requires: [
                   'Ext.tab.Panel',
                   'Ext.form.*',
                   'Ext.field.*',
                   'Ext.Button',
                   'Ext.data.Store'
                   ],

                   launch: function() {            
                       var list= Ext.create("Ext.NavigationView",{
                               xtype: 'list',
                               itemTpl: 'D:{id} - C:{c}',
                               store: myStore,
                               fullscreen: true,
                               layout:'fit',
                               title:'listtitle',
                               onItemDisclosure: function (record, btn, index) {
                                   view.push({
                                       xtype: 'panel',
                                       renderTo: document.body,
                                       layout:'fit',
                                       title: 'second view',
                                       html: 'second view',
                                       styleHtmlContent: true
                                   });
                               }
                       });


                       var myTitle= {
                                       xtype: 'titlebar',
                                       id: 'myTitle',
                                       docked: 'top',
                                       title: 'mytitle'//,
                                    };
                       var myMean={ 
                                       xtype: 'titlebar',
                                       id: 'myMean',
                                       docked: 'bottom',
                                       title: 'myMean'
                                   };


                       listpanel = new Ext.Panel({
                           xtype:'panel',
                           header:true,
                           layout: 'fit',   // important to make layout as 'fit'
                           id:'listpanel',
                           title:'listpanel',
                           items: [myTitle,myMean,list]
                       });


                        var view = Ext.create("Ext.NavigationView", {
                           layout:'fit',
                           id:'view',
                           items: [listpanel]
                       });

                       Ext.Viewport.add({
                           xtype: 'tabpanel',
                           tabBarPosition: 'bottom',
                           items: [
                                   {
                                       title: '1-tab',
                                       layout:'fit',
                                       iconCls: 'home',
                                       html:'tab1',
                                        cls: 'card1'

                                   },
                                   {
                                       title: '2-tab',
                                       layout:'fit',
                                       iconCls: 'download',
                                       html:'tab2',
                                       cls: 'card2'
                                   },
                                   {
                                       title: '3-tab',
                                       layout:'fit',
                                       iconCls: 'home',
                                       items: [view],
                                       cls: 'card3'
                                   },
                                   {
                                       title: '4-tabs',
                                       layout:'fit',
                                       iconCls: 'home',
                                       html: '4-tab',
                                       cls: 'card4'
                                   }
                                   ]
                       });
        }
};
Ext.application(config);
4

2 回答 2

1

您是否尝试过设置 flex: 1, layout: 'vbox' 而不是 layout: 'fit'?

于 2012-05-02T11:12:45.533 回答
1

解决了在 var 列表中删除全屏:true,layout:'fit' 的问题。

于 2012-05-02T12:38:13.200 回答