论坛首页 Java企业应用论坛

动态自增表格rich:dataTable

浏览 5939 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-05-24  

页面

<rich:dataTable id="tb1" value="#{tbtest.tb}" var="tbmethod"
      width="600px">
      <f:facet name="header">
       <rich:columnGroup>
        <rich:column colspan="2">
         <h:outputText value="采集要素"></h:outputText>
        </rich:column>
       </rich:columnGroup>
      </f:facet>
      <rich:column>
       <f:facet name="header">
        <h:outputText value="值一"></h:outputText>
       </f:facet>
       <a4j:commandLink value="#{tbmethod.value1}" reRender="pp1"
        action="#{tbdb.selValue}" style="width:250px">
        <a4j:actionparam name="pa1" value="#{tbmethod.id}"
         assignTo="#{tbdb.id}" />
       </a4j:commandLink>
      </rich:column>
      <rich:column>
       <f:facet name="header">
        <h:outputText value="值二"></h:outputText>
       </f:facet>
       <h:outputText value="#{tbmethod.value2}" escape="false" style="width:250px"></h:outputText>
      </rich:column>
     </rich:dataTable>

 

java文件

private List<SetAllInfo> tb;

Map maps = FacesContext.getCurrentInstance().getExternalContext()
    .getSessionMap();

public TestTest() ...{
}

public void Add(SetAllInfo setinfo) ...{
   tb = new ArrayList<SetAllInfo>();
   List kk = (ArrayList) maps.get("xiaoyi");
   if (kk != null) ...{
    tb = kk;
   }
   if("".equals(setinfo.getValue1()))
   ...{
    setinfo.setValue1(" ");
   }
   if("".equals(setinfo.getValue2()))
   ...{
    setinfo.setValue2(" ");
   }
   tb.add(setinfo);
   maps.put("xiaoyi", tb);
}

public void del(long ids) ...{
   tb = (ArrayList) maps.get("xiaoyi");
   for (int i = 0; i < tb.size(); i++) ...{
    SetAllInfo ss = tb.get(i);
    if (ids == ss.getId()) ...{
     tb.remove(i);
     maps.put("xiaoyi", tb);
     break;
    }
   }
}

public void update(SetAllInfo info) ...{
   List<SetAllInfo> tbtemp = (ArrayList) maps.get("xiaoyi");
   for (int i = 0; i < tbtemp.size(); i++) ...{
    SetAllInfo sai = tbtemp.get(i);
    if (info.getId() == sai.getId()) ...{
     // tb.remove(i);
     // tb.add(i, info);
     tbtemp.set(i, info);
     tb = tbtemp;
     // tb.addAll(tbtemp);
     // tb=tbtemp;
     maps.put("xiaoyi", tb);
     break;
    }
   }
}

public SetAllInfo selElem(long flagRow) ...{
   SetAllInfo ss = new SetAllInfo();
   tb = new ArrayList<SetAllInfo>();
   List lis = (ArrayList) maps.get("xiaoyi");
   if (lis != null) ...{
    tb = lis;
    for (int i = 0; i < tb.size(); i++) ...{
     ss = tb.get(i);
     if (flagRow == ss.getId()) ...{
      break;
     }
    }
   }
   return ss;
}

public List<SetAllInfo> getTb() ...{
   tb = (ArrayList) maps.get("xiaoyi");
   return tb;
}

public void setTb(List<SetAllInfo> tb) ...{
   this.tb = tb;
} 

 

   发表时间:2008-05-28  
看不明白,在那里自增了?
0 请登录后投票
   发表时间:2008-10-24  
可以详细介绍一下,a4j:commandLink在richfaces中richtable中应用。

我的代码是: <a4j:commandLink id="idyflagk" value="#{sysstatus.failureCnt}"
action="#{SysIntegStatCountBean.getFailureCntStatus}"
reRender="dataGrid1,dxCauseTemplateSetDiv" immediate="true">
  <a4j:actionparam name="thirdHost" value="#{sysstatus.thirdHost}"></a4j:actionparam>  
</a4j:commandLink>

但是链接根本不起作用。getFailureCntStatus是bean中的方法dataGrid1,dxCauseTemplateSetDiv是渲染的区域thirdHost是参数。
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics