【问题标题】:Sencha Touch default item selection in listSencha Touch 列表中默认项目选择
【发布时间】:2014-07-20 08:50:25
【问题描述】:

默认情况下如何选择列表中的第一项而不点击它?以下是我的看法。

Ext.define('MyApp.view.TestList', {
    extend: 'Ext.List',
    xtype: 'testlist',
    config: {
        flex: 1,
        enableSelection: true,
        itemTpl: '{item}',
        data: [
            {item: 'item-1'},
            {item: 'item-2'},
            {item: 'item-3'},
            {item: 'item-4'}
        ]
    }
});

【问题讨论】:

    标签: sencha-touch sencha-touch-2.3


    【解决方案1】:

    Ext.List 有两种方法可以帮助您:

    list.select( record, keepExisting, surpessEvent );
    list.selectRange( startRecordIndex, endRecordIndex, keepExisting );
    

    在您的情况下,您可以使用list.selectRange( 1, 1, false ); 选择第二条数据记录。

    【讨论】:

      猜你喜欢
      • 2011-07-19
      • 2013-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多