У меня есть таблица данных с помощью celleditor, и я хочу напечатать таблицу данных без последней строки.
Я разрешаю добавить новую строку, и когда я go для печати хочу удалить строку blan c. Удаленной командой я удаляю линию, но эта строка появляется на распечатке.
боб. java
public void addRow(){
listTest.add(new Teste(0, 0));
PrimeFaces requestContext = PrimeFaces.current();
requestContext.executeScript("PF('dtTestesVar').addRow()");
}
public void remove() {
listTest.remove(listTest.size()-1);
}
index.x html
<p:panel id="printer" style="border: 0px !important;">
<p:dataTable id="dtTestes" var="teste"
value="#{vc.testes}" editable="true"
editMode="cell" widgetVar="dtTestesVar">
(...)
</p:dataTable>
</p:panel>
<p:remoteCommand name="rc"
update="dtTestes"
actionListener="#{vc.remove}" />
<p:commandButton type="button" value="Print" onclick="rc()"
icon="ui-icon-print">
<p:printer target="printer" />
</p:commandButton>
Мое решение:
<p:commandButton value="print" actionListener="#{vc.removeRow}" process="@this" update="dt" oncomplete="$('#form\\:print').click(); addRow();" />
<p:commandButton id="print" value="myprint" style="visibility: hidden;">
<p:printer target="dt" />
</p:commandButton> <p:remoteCommand name="addRow" actionListener="#{vc.addRow}" update="dt" />