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时,会出现数组越界*/ } }

 

相关文章:

  • 2021-09-23
  • 2022-12-23
  • 2021-05-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
猜你喜欢
  • 2022-12-23
  • 2022-03-05
  • 2021-06-02
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案