JavaScript
A5.ListBoxscrollToItem Method
Syntax
A5.ListBox.scrollToItem(target[,settings])
Arguments
- targetstringnumberobject
The index or value of the row in the list to scroll to. See A5.ListBox.getIndex.
- settingsobject
The scroll settings. See A5.u.element.setScroll.
Description
Scroll to a target row in the list.
Example
// To get a pointer to the A5.ListBox class see {dialog.object}.getControl // assume lObj is a pointer to an instance of the A5.ListBox class lObj.scrollToItem('ALFKI'); // scroll to the row with the value of "ALFKI"
Example: Scrolling a List Control
The example below demonstrates scrolling a List Control in a UX Component. The List will be scrolled to bring the row with the value 'Smith' into view.
var listObj = {dialog.object}.getControl('list1'); //assume that the List was configured to return Lastname values. //Scroll to the row that has 'smith' listObj.scrollToItem('Smith'); //scroll to top of list listObj.scrollToItem(0); var options = {}; options.mode = 'top' //can be 'top', 'bottom', or 'into-view' options.animation = {}; options.animation.allow = true; options.animation.duration = 200; options.offset = {}; options.offset.y = 10; //number of pixels between the target row and top of List listObj.scrollToItem(0,options);
See Also