如何创建 Ext.tree.Panel 在节点展开/折叠时自动调整大小以适应其内容?
问问题
2418 次
1 回答
4
这是一个有点肮脏的解决方法,但作为一个快速的解决方案对我来说很好。
var tree = Ext.create('Ext.tree.Panel', {
//...
//configuration goes here
//...
animate: false,
//...
listeners:{
load: function(){
resetHeight(this);
},
itemexpand: function(){
resetHeight(this);
},
itemcollapse: function(){
resetHeight(this);
}
}
}
function resetHeight(cmp){
setTimeout(function(){
var innerElement = cmp.getEl().down('table.x-grid-table');
if(innerElement){
var height = innerElement.getHeight();
cmp.setHeight(height);
}
}, 200);
}
于 2012-08-21T09:08:02.993 回答