1

In my project I'm using PrimeFaces components to define GUI. I'm using TreeTable component, where its items can be selected and the body is scrollable.

Next to the table, I have a CommandButton, that adds the new item to the table. This item is then created, TreeTable is updated via ajax and the new item is selected. Problem I'm trying to solve is how to scroll to the new item. I have item's row key, so I can reconstruct its id, so I've tried to add this to my CommandButton:

oncomplete="PrimeFaces.focus('form1:mainTreeTable_node_0_0_3_1');", where 0_0_3_1 is the row key. This only focuses the row, but does not scroll the body of the table to it. Is there a way how to achieve this behaviour?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Micer
  • 8,731
  • 3
  • 79
  • 73

1 Answers1

2

In the end, it is all html, css and javascript. Where they are in this case all supported by jquery.

See also:

Community
  • 1
  • 1
Kukeltje
  • 12,223
  • 4
  • 24
  • 47
  • Thanks, you kicked me in the right direction! `RequestContext scrollTo` method works only with page body (in PF 4.0), but I was able to implement my own similar method that handles scroll in TreeTable. – Micer Mar 25 '15 at 07:51