Reputation: 1038
I have a PrimeFaces dataTable that gets refreshed on actions of various controls of the page. (I use p:ajax update="myDataTable"
..)
I have a JavaScript method calling row.scrollIntoView(true)
on the last table row. (The nicer row.scrollIntoViewIfNeeded(true)
seems to be available only in Chrome.)
Well, I need the table to scroll to the last entry on such a refresh. Is there any event I can listen to? Or is there an alternative way?
Upvotes: 1
Views: 6016
Reputation: 2182
Use JQuery for (it's supported by PrimeFaces natively):
function scrollToBottom() {
$('.ui-datatable-scrollable-body').scrollTop(100000)
}
Next,
<p:ajax update="myDataTable" oncomplete="scrollToBottom()"/>
Upvotes: 2
Reputation: 30025
The p:ajax
tag has an oncomplete
attribute. You could use:
<p:ajax update="myDataTable" oncomplete="yourJsMethod()"/>
Upvotes: 1