diff --git a/src/main/java/com/flowingcode/vaadin/addons/chatassistant/ChatAssistant.java b/src/main/java/com/flowingcode/vaadin/addons/chatassistant/ChatAssistant.java index 9a38575..6387f9f 100644 --- a/src/main/java/com/flowingcode/vaadin/addons/chatassistant/ChatAssistant.java +++ b/src/main/java/com/flowingcode/vaadin/addons/chatassistant/ChatAssistant.java @@ -272,5 +272,32 @@ public Component getFooterComponent() { return footerComponent; } + /** + * Scrolls to the given row index. Scrolls so that the element is shown at + * the start of the visible area whenever possible. + *

+ * If the index parameter exceeds current item set size the grid will scroll + * to the end. + * + * @param rowIndex + * zero based index of the item to scroll to in the current view. + */ + public void scrollToIndex(int position) { + this.content.scrollToIndex(position); + } + + /** + * Scrolls to the first element. + */ + public void scrollToStart() { + this.content.scrollToStart(); + } + + /** + * Scrolls to the last element of the list. + */ + public void scrollToEnd() { + this.content.scrollToEnd(); + } }