sencha水平滚动列表

时间:2014-11-15 20:44:37

标签: list sencha-touch sencha-touch-2 sencha-touch-2.3

我正在尝试按照Sencha给出的列表水平示例。 我收到一条消息说  (DataView的基本布局必须始终是适合布局) 在示例中,它不是合适的布局。有人可以告诉我这里缺少什么。 谢谢 吉姆

  Ext.define( 'Styles.view.Beginning', { 
    extend: 'Ext.List',
    xtype: 'beginninglist',

    config: {
     title:'Beginning',
     iconCls: 'star',


 layout:{
     type:'vbox',
     pack: 'center'
 },
   items:[

    {

      //give it an xtype of list for the list component
                xtype: 'dataview',
                height: 250,


                scrollable: 'horizontal',
                directionLock: true,
                inline: {
                    wrap: false
                },


                //set the itemtpl to show the fields for the store
                itemTpl: '{name} {image}',


                //bind the store to this list
                 store: 'Beginning'

    }

     ]

   }
  });

1 个答案:

答案 0 :(得分:0)

首先,您需要学习Sencha布局。你可以参考here。您正在创建List,然后尝试将Dataview放入其中。因此,如果您需要Dataview,请直接扩展Dataview,如下所示:

Ext.define('Styles.view.Beginning', {
        extend: 'Ext.dataview.DataView',
        xtype: 'beginninglist',
        config: {
            inline: {
                wrap: false
            },
            scrollable: {
                direction: 'horizontal'
            },

            //set the itemtpl to show the fields for the store
            itemTpl: '{name} {image}',

            //bind the store to this list
            store: 'Beginning'
        }
    });
相关问题