How to call scrollTo method in WTreeTable

Added by Chandana Kumara almost 2 years ago

I want scroll level of the table should be kept across re-binding/refreshes to avoid forcing the user to have to re-scroll to previous position. How can I keep the same position (scroll to selected node) after the action triggered on WTreeTableNode?


Replies (8)

RE: How to call scrollTo method in WTreeTable - Added by Chandana Kumara almost 2 years ago

Kindly request answer for this problem as soon as possible.

RE: How to call scrollTo method in WTreeTable - Added by Koen Deforche almost 2 years ago

Hey,

You will need to identify the 'selected node' with something else than the WModelIndex, because changes to the model also change model indexes. After the action you then get the (possibly modified) WModelIndex from this basic information and then use scrollTo().

Regards,
koen

RE: How to call scrollTo method in WTreeTable - Added by Chandana Kumara almost 2 years ago

This can do with WTreeView. But it could not do with WTreeTable. Because WTreeTable does not have scrollTo(). Then how can I do scrollTo() with WTreeTable?

RE: How to call scrollTo method in WTreeTable - Added by Koen Deforche almost 2 years ago

Ah sorry.

I thought it was a typo (WTreeTable versus WTreeView). With WTreeTable there is not such a function available, but there's the following (undocumented) way to do it:

  doJavaScript(WT_CLASS ".scrollIntoView('" + node->id() + '");");

RE: How to call scrollTo method in WTreeTable - Added by Chandana Kumara almost 2 years ago

Thanks for solution.

But this solution perfecly work with the firefox. But There is a issue with chrome. In chrome browser does not scroll to exact position as firefox. It is working strange.
Pls send the solution for this problem?

RE: How to call scrollTo method in WTreeTable - Added by Chandana Kumara almost 2 years ago

Chandana Kumara wrote:

Thanks for solution.

This solution perfecly work with the firefox. But There is a issue with chrome. In chrome browser does not scroll to exact position as firefox. It is working strange.
Pls send the solution for this problem?

RE: How to call scrollTo method in WTreeTable - Added by Koen Deforche almost 2 years ago

Hey,

Can you describe more clearly how "strange" it behaves, preferably using a test case?
We are currently unable to reproduce the issue here.

Koen

RE: How to call scrollTo method in WTreeTable - Added by Chandana Kumara almost 2 years ago

In the firefox :-
After execute the action on tree node it is scroll to action executed tree node within the view area on the browser

In Chrome :-
After execute the action on tree node it is not scroll to action executed tree node within the view area on the browser. It is not set scroll exact position and showing another place of the tree.

Here I attached two screen shot for firefox and chrome. You can see it is not scroll to exact node on chrome screenshot.

Thanks.

chrome.png (84.5 KB)

firefox.png (60.5 KB)

(1-8/8)