TreeTable 滚动到所选项目
TreeTable scroll to selected item
在我的项目中,我使用的是 PrimeFaces components to define GUI. I'm using TreeTable
组件,它的项目可以在其中选择,主体是可滚动的。
在 table 旁边,我有一个 CommandButton
,它将新项目添加到 table。然后创建该项目,通过 ajax 更新 TreeTable
并选择新项目。我要解决的问题是如何滚动到新项目。我有项目的行键,所以我可以重建它的 ID,所以我试图将它添加到我的 CommandButton
:
oncomplete="PrimeFaces.focus('form1:mainTreeTable_node_0_0_3_1');"
,其中 0_0_3_1 是行键。这只会聚焦该行,但不会将 table 的主体滚动到它。有没有办法实现这种行为?
最后都是html、css和javascript。在这种情况下,它们都由 jquery.
支持
另请参阅:
- Scroll to top on messages rendered in PrimeFaces
- http://blog.primefaces.org/?p=1795
- Primefaces RequestContext scrollTo does not work
在我的项目中,我使用的是 PrimeFaces components to define GUI. I'm using TreeTable
组件,它的项目可以在其中选择,主体是可滚动的。
在 table 旁边,我有一个 CommandButton
,它将新项目添加到 table。然后创建该项目,通过 ajax 更新 TreeTable
并选择新项目。我要解决的问题是如何滚动到新项目。我有项目的行键,所以我可以重建它的 ID,所以我试图将它添加到我的 CommandButton
:
oncomplete="PrimeFaces.focus('form1:mainTreeTable_node_0_0_3_1');"
,其中 0_0_3_1 是行键。这只会聚焦该行,但不会将 table 的主体滚动到它。有没有办法实现这种行为?
最后都是html、css和javascript。在这种情况下,它们都由 jquery.
支持另请参阅:
- Scroll to top on messages rendered in PrimeFaces
- http://blog.primefaces.org/?p=1795
- Primefaces RequestContext scrollTo does not work