我正在使用树列表,我想动态更改我在 afterrender 函数上选择的导航列表。
Ext.create({
xtype: 'treelist',
reference: 'navigationTreeList',
itemId: 'navigationTreeList',
ui: 'nav',
store: Ext.create('Ext.data.Store', {
fields: [{
name: 'text'
}],
root: {
expanded: true,
children: [{
text: 'Dashboard',
iconCls: 'x-fa fa-home',
rowCls: 'nav-tree-badge',
viewType: 'dashboardcei',
routeId: 'cei/dashboardcei',
leaf: true
},
{
text: 'Create Application',
iconCls: 'x-fa fa-send',
rowCls: 'nav-tree-badge',
routeId: 'cei/create-application',
viewType: 'create-application',
leaf: true
},
{
text: 'Application Status',
iconCls: 'x-fa fa-user',
routeId: 'cei/application-status',
viewType: 'application-status',
leaf: true
}
]
}
}),
width: 250,
expanderFirst: false,
expanderOnly: false,
listeners: {
afterrender: function(tree) {
var selection = tree.getStore().getData().items[1]; // bydefault "create application page should be open instead of dashboard"
tree.fireEvent('selectionchange', tree, selection);
}
}
});
以上是我在渲染功能中的实验,以在从树列表加载页面时默认打开“创建应用程序页面”。它打开了页面,但是树列表上的实际选择没有发生,就像选择仍然很旧,这是我过去两天面临的问题,谁能帮我解决这个问题