我在EXTJS工作,请检查下面的例子:哪个是正确的使用doLayout函数的监听器?
var containerForm=Ext.widget('panel',{
width: 1100,
border: false,
frame: true,
"layout":"fit",
title: 'Add User',
hidden:true,
listeners:{
'afterrender': function(panelObj,eOpts)
{
panelObj.doLayout();
}
}
});
上述面板的HTML是通过AJAX响应更新为显示在下面的代码:
formObj.update(jsonResp.html,true,function(){
containerForm.doLayout();containerForm.focus();
});
containerForm是自动高度面板,因为此面板用于多个章节目标,
当“formObj.update”填充此面板的内容,它的内容加载正常,但
如果Ajax响应“jsonResp.html”有任何图像,那个时候doLayout()函数没有帮助正确调整面板高度,
我在2个地方添加了doLayout函数,但回调函数在上面的例子中没有帮助我:
当我打电话的doLayout功能2秒后则只有它的正常工作:
formObj.update(jsonResp.html,true,function(){
setTimeout('containerForm.doLayout(); containerForm.focus();', 2000);
});
就是用的doLayout功能适当的听众?
感谢贾斯汀你的回答,我会尝试这个解决方案 – sarvesh 2013-03-07 06:11:45