我有一个dataTable,在用对话框更新记录并执行位置脚本后,记录会重复。
<p:dataTable id="tbl"
value="#{fincaBean.listFinca}" var="f"
emptyMessage="sin registros"
selection="#{fincaBean.slcFinca}"
selectionMode="single"
rowKey="#{f.finid}"
filteredValue="#{fincaBean.filtroFinca}"
scrollRows="20"
liveScroll="true"
scrollable="true"
scrollHeight="350">
.....
<p:commandButton onstart="saveScrollPos()" oncomplete="PF('finDialog').show()" actionListener="#{fincaBean.actualizarFinca(f) }" update=":updateFinca" process="@this" icon="ui-icon-search" title="Detalle">
....
....
</dataTable>
//*************************************************************//
<p:dialog id="detalleFin" style="max-width:800px;max-height:380px"
height="80vh" width="98%" position="center" header="Detalle Finca"
widgetVar="finDialog" modal="true" showEffect="fade"
hideEffect="fade" resizable="false">
....
....
<p:commandButton value="Save" actionListener="#fincaBean.guardarFinca(fincaBean.finca)}" oncomplete="getScrollPos()" update="@form :formFinca:tbl" process="@all">
</p:dialog>
<script type="text/javascript">
$ = jQuery;
var scrollPos;
function saveScrollPos() {
scrollPos = $(".ui-datatable-scrollable-body").scrollTop();
}
function getScrollPos() {
$(".ui-datatable-scrollable-body").scrollTop(scrollPos);
}
</script>
图像 - &GT; https://i.stack.imgur.com/0fKv6.jpg