那麼你可以嘗試不使用liveScroll,因爲你不知道dataList的結束。試試這個,也許這適合你的需求。這將會延遲到你的dataTable的底部。
<h:form prependId="false">
<p:dataTable id="dataTable" var="c" value="#{MessagingUserBean.inboxDetails1}" scrollHeight="517" liveScroll="true" emptyMessage="No Message Found" scrollWidth="815" >
//Your dataTable stuff
</p:dataTable>
</h:form>
<script>
//Get the scrollheight
var s = jQuery('#dataTable .ui-datatable-scrollable-body').prop('scrollHeight');
//Get total size of datatable
var o = jQuery('#dataTable .ui-datatable-scrollable-body').prop('offsetHeight');
//calculate how many times it can scrolldown to set your timer
var t = Math.ceil(s/o);
//Excute scrolldown animation (max scrolldown is scrollHeight - offsetHeight)
$('#dataTable .ui-datatable-scrollable-body').animate({scrollTop:s-0}, t*1000);
</script>
會反向排序修復它嗎? – kostja
不,我想做一個像facebook一樣的消息功能。 – Rounak