我刚有<p:dataTable/>
。当我在另一个页面中向该表添加新行时,该表不会刷新。RmaBean 是 managedBean 范围的会话。有任何想法吗?
<h:form id="mainMenuForm">
<p:dataTable id="dataTable"
var="case"
value="#{RmaBean.rmaModel}"
widgetVar="rmaTable"
editable="true"
rows="10" paginator="TRUE" emptyMessage="No items found with given criteria.">
...
<p:column></p:column>
<p:column></p:column>
<p:column><p:commandButton action="#{MainController.talletaUusiRma}" value="#{bundle.newRma_tallenna}" immediate="true" ajax="false" style="width: 220px;"/></p:column>
</p:row>
当我向该表添加一个新对象时,我只是rmaModel
每次都更新,我什至检查列表是否比以前长一个,并且有那个新对象。数据表仍然显示没有新对象的旧数据,为什么?
--------创建新的 RMA-------------
public String prepareNewRma() {
current = new Rma();
current.setUser("");
return "newRma";
}
--------使用序列号将数据提取到新的 RMA-----
public String haeTiedotSarjanrolla() {
log.info("sarjanro=" + current.getSarjanro());
System.out.println("---------------->sarjanro=" + current.getSarjanro());
Sarjanumerot s = helper.getSerialInfo(current.getSarjanro());
if (s != null) {
current.setAn8(s.getAn8());
current.setDsc1(s.getDsc1());
current.setDsc2(s.getDsc2());
current.setSarjanro(s.getId().getLotn());
current.setTuotenro(s.getId().getLitm());
}
return "newRma";
}
--------保存新的 RMA----------------
public String talletaUusiRma() {
current.setCreated(new Timestamp(System.currentTimeMillis()));
helper.tallennaRma(current);
rmaNumbers = null;
RmaBean papu = (RmaBean) JsfUtil.findBean("rmapapu");
papu.updateTable();
return "mainMenu";
}
帮手:
public void tallennaRma(Rma current) {
try {
Session session = HibernateUtil.getAsekorjausSessionFactory().getCurrentSession();
session.beginTransaction();
session.saveOrUpdate(current);
session.getTransaction().commit();
} catch (Exception e) {
log.debug(e.getMessage());
JsfUtil.addErrorMessage(ResourceBundle.getBundle("resources/Bundle").getString("editRma_err_updateError"));
}
---------在 RmaBean 中更新模型和表格-----------
public void updateTable(){
System.out.println("updateTableupdateTableupdateTable");
rmaModel.setWrappedData(rmaModel.getUpdatedList());
System.out.println("1111111..........");
List<Rma> rmat = rmaModel.getUpdatedList();
System.out.println("22222222.......");
Iterator iter = rmat.iterator();
System.out.println("------------------------>PITUUS: " +rmat.size());
while (iter.hasNext()) {
Rma t = (Rma) iter.next();
System.out.println("t.getRma()NUMERO------->" +t.getRma());
}
RmaDataModel newRMAModel = new RmaDataModel(rmat);
rmaModel = newRMAModel;
}
萨米人