最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - sap.m.Table: How to scroll to given listItem - Stack Overflow

programmeradmin2浏览0评论

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();
发布评论

评论列表(0)

  1. 暂无评论