0

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

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'}
        ]
    }
});
4

1 回答 1

1

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

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

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

于 2014-07-20T12:22:49.133 回答