Webaction Scroll to inside Datagrid 2

0
Hi everyone, I am trying to fix the following issue. I have a Datagrid 2 with virtual scrolling. It is possible to add new Objects to the Datagrid. But, once over 20+ lines/items, the new objects are added but there is no focus on the new object. There is logic that the new object is automatically the selected one, so I tried to use the webaction Scroll to, with the target selector the (dynamic) class on the new (selected) row. After inspection, I can see that the class is on the element, but somehow the Javascript action doesn't find the item. Any recommendations? PS, I tried to focus on a static Image with the targeted class on it, outside the Datagrid, and that does work..
asked
1 answers
0

This is possible to do. You just have to select the right class to scroll to. The element that gets the dynamic row class is not rendered, making it a bit complicated.

 

- Add a dynamic row class to the data grid for the item you want to scroll to. For example ‘selected’,

- Run the app and inspect on which element the class is added to. Probably it is the ‘.tr’ element. This element is set to display: contents, which means it is not rendered and it is not possible to scroll to.

- To solve this choose a child element inside the tr element to scroll to, for example a ‘.td’ element.

- The scrollto action input would then be: ‘.selected .td’. The first element with class td inside an element with class selected.

answered