How to Capture and Restore the List's Scroll Position
Description
Refreshing data in a list can sometimes cause it also reset it's scroll position. You can restore the List's scroll position by capturing the position before refreshing or performing some operation on the List and restore the scroll position after the operation completes with a few lines of code.
Discussion
In some applications it might be necessary to restore the List's scroll position without actually selecting a row in the List. For example, a List may have been scrolled to a certain position, but no record in the List has been selected. A refresh operation on the List is performed, and now you want to scroll the List back to its previous position.
Here is how you can do this (assume that the List ID is 'LIST1'):
Example
//capture the scroll position var eleID = {dialog.object}.getControl('LIST1').contId + '.CONTENTWRAPPER'; var obj = A5.u.element.getScroll(eleID) {dialog.object}._scroll = obj; //restore the scroll position var obj = {dialog.object}._scroll var eleID = {dialog.object}.getControl('LIST1').contId + '.CONTENTWRAPPER'; A5.u.element.setScroll(eleID,obj.left,obj.top);
See Also