如何在 ExtJS MultiSelector 搜索框中预选项目

How to preselect items in ExtJS MultiSelector search box

有没有办法操纵 MultiSelector Search 组件来预选某些项目?

相关链接:

MultiSelector KitchenSink example
MultiSelector Docs Sencha page
MultiSelectorSearch Docs Sencha page

通过在 afterrender 的 MultiSelectorSearch 组件中选择记录解决:

search: {
    ...
    listeners:
    {
        afterrender: function(cpt)
        {
             // existing items store is sent through the MultiSelector config
             cpt.selectRecords(me.getExistingStore().getData());
         }
    }
}