WebListBox scroll to bottom

Add this method to a module.

Public Sub scrollToRow(extends l as WebListBox, rowIndex as Integer)
  '// Call as:
  '   myListbox.scrollToRow(99)
  if Session <> Nil then
    Session.ExecuteJavaScript( "$('#" + l.ControlID + "_table').dataTable().api().scroller.toPosition(" + rowIndex.toString("#0" ) + ")" )
  end if
End Sub

To scroll to the bottom, something like:

myListbox.scrollToRow(myListBox.RowCount - 1)
3 Likes