admin管理员组

文章数量:1406019

I am using a sap.m.Table to display my entries. The user has the possibility to delete list items and in that case I would like to scroll to the list item which was below or above the deleted one once, the binding is updated. I do get the position of the deleted list item by calling indexOfItem but how to scroll to that position I don't know.

Any idea?

Thanks

I am using a sap.m.Table to display my entries. The user has the possibility to delete list items and in that case I would like to scroll to the list item which was below or above the deleted one once, the binding is updated. I do get the position of the deleted list item by calling indexOfItem but how to scroll to that position I don't know.

Any idea?

Thanks

Share Improve this question asked Dec 8, 2014 at 16:35 AntonSackAntonSack 1,0512 gold badges27 silver badges50 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

answer of your question should be

oList.getItems()[index].getDomRef().scrollIntoView().

but not to loose the keyboard navigation you can call

oList.getItems()[index].focus(); 

then browser will scroll to the item as well since m lib uses native scrolling. focus method is public for every control.

Since 1.26 you can just call oList.focus(); list remembers the last focused item for you.

something like this should work in a delete handler.

oList.attachEventOnce("updateFinished", oList.focus.bind(oList));
deleteSelectedRecordFromModel();

本文标签: javascriptsapmTable How to scroll to given listItemStack Overflow