更新时间:2023-10-09 08:49:46
我使用以下帖子完成了上述操作
I did the above using the following post
我的代码
脚本
function saveScrollPos() {
var scrollPos = jQuery('#receptionFORM\\:receptionTV\\:scheduleDataTable .ui-datatable-scrollable-body').prop('scrollTop');
document.getElementById('receptionFORM:scrollPos').value = scrollPos;
}
function autoScroll() {
var scrollPos = document.getElementById('receptionFORM:scrollPos').value;
jQuery('#receptionFORM\\:receptionTV\\:scheduleDataTable .ui-datatable-scrollable-body').animate({scrollTop:scrollPos}, scrollPos);
}
HiddenInput
HiddenInput
<h:inputHidden id="scrollPos" />
在数据表行的Ajax事件中选择
In Ajax event of datatable row select
onstart="saveScrollPos()"
保存记录时,在CommandButton中使用以下代码
The below code in CommandButton while saving record
oncomplete="autoScroll()"