当我试图做到根据不同的参数给同一接口展示不同的页面时,利用jquery无法修改页面的宽度。
发现必须修改extjs的容器才能修改页面的内容。
//如果sbxztree_isremovebutton=Y就移除sbtreebuttonpanel容器。
function hideSbtreebuttonpanel(sbxztree_isremovebutton){
if(sbxztree_isremovebutton == "Y"){
var removeBt=Ext.getCmp("sbtreebuttonpanel");//获取树容器
var father=removeBt.ownerCt;
father.remove(removeBt);
// extjs的样式都是包含在容器里面的。并通过容器里面的内容渲染页面。比如,调整页面大小,那么extjs会重新利用容器来渲染页面
// 如果仅仅利用jquery的方法$("#sbtreebuttonpanel").remove(); 来移除。
// 此时调整页面大小,该该sbtreebuttonpanel仍然会渲染出来。因为父容器内仍然存在该容器。
// 所以必须从父容器内移除该容器
/*var commonPage=Ext.getCmp("sbtreepanel");//获取树容器
commonPage.height=$(window).height();*/
/*debugger;
$("#sbtreebuttonpanel").remove();
$("#sbtreepanel").css("height",$(window).height());
$("#sbtreepanel-body").css("height",$(window).height());*/
}
}

本文探讨了使用ExtJS框架进行页面布局调整的方法,特别是在不同参数下展示不同页面内容时,如何通过操作ExtJS容器实现页面元素的动态增删与自适应布局。文章对比了jQuery与ExtJS在页面元素管理上的差异,强调了ExtJS容器在页面渲染和尺寸调整中的核心作用。

394

被折叠的 条评论
为什么被折叠?



