SubLayout隐藏子控件有两种方法
OASubTabLayoutBean layBean = (OASubTabLayoutBean) webBean.findIndexedChildRecursive("subTabs_rn"); OASubTabBarBean barBean = (OASubTabBarBean) layBean.getSubTabs(); //移除子标签 barBean.removeLink(1); layBean.removeIndexedChild(1); //隐藏子标签 layBean.hideSubTab(i, true);
//懒得数子控件索引INDEX,直接隐藏 OARenderingContext rc = pageContext.getRenderingContext(); // for (int i =0; i<layBean.getIndexedChildCount(); i++){ // layBean.getIndexedChild(rc, i).getID() // } for (int i = 0; i < barBean.getIndexedChildCount(); i++) { String itemId = barBean.getIndexedChild(rc, i).getID(); if ("linedetail".equals(itemId)) { layBean.hideSubTab(i, true);
//等价
// layBean.removeIndexedChild(i);
// barBean.removeLink(i);
/*在for循环中使用remove方法时,不要声明int count = barBean.getIndexdChildCount(), i < count
否则remove之后,控件总和少1,循环到最大count时,会出现数组越界*/ } }