- This topic has 4 replies, 3 voices, and was last updated 4 years, 6 months ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.
JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › ListBox › scroll to newly selected item
Tagged: listbox, listbox web component
hello –
is it possible to have the newly selected item scroll into view? here is an example where i am trying to select the bottom item, Toyota:
https://codepen.io/edwardsmarkf/pen/RwWGpXo?
note, i dont want to merely scroll to the bottom, but i would like to see the selected item visible in the scrolling window.
thank you very much.
Hi,
The ensureVisible method scrolls to an item: https://www.htmlelements.com/docs/listbox-api/#toc-ensurevisible
Regards,
Boyko
sorry i cannot seem to get it to work properly:
https://codepen.io/edwardsmarkf/pen/RwWGpXo
could you please look at my code & let me know what i am doing incorrectly?
Hi,
You should use the “value” not the “label” of the Item.
Example:
function selectToyota() { list.ensureVisible("toyota");}
Regards,
Peter
thank you!