var tree = Ext.create('Ext.tree.Panel', {
store: store,
rootVisible: false,
//useArrows: true,
frame: true,
title: 'Vehicle List',
region:'west',
width: 200,
root: {
expanded: true
},
checked : false,
height: 250,
dockedItems: [{
xtype: 'toolbar',
items: {
text: 'Get checked nodes',
handler: function(){
var records = tree.getView().getChecked(),
names = [];
Ext.Array.each(records, function(rec){
names.push(rec.get('MainID'));
});
Ext.MessageBox.show({
title: 'Selected Nodes',
msg: names.join('<br />'),
icon: Ext.MessageBox.INFO
});
}
}
}]
});
如何讓樹擴展?我試過如何在頁面加載時擴展樹面板 - EXTJS 4
root: {
expanded: true
}
但它仍然不起作用。你從服務器返回的每個節點
{ name: 'expanded', type: 'boolean', defaultValue: true, persist: false },
或可選擇地設置expanded
爲true:
替代解決方案適用於我。 – Michel 2016-07-19 20:51:40