Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Finding row index in TreeLayer
Finding row index in TreeLayer [message #1386405] Tue, 17 June 2014 11:01 Go to next message
Rajesh Arumugam is currently offline Rajesh ArumugamFriend
Messages: 24
Registered: October 2013
Junior Member
Hi All,

I created a nattable and customer wants to show the data in tree view. So i modified the code and i am able to see the data in tree.. In my previous design, i added a custom menu item- 'Insert Row' on RowHeaderLayer to add new row into the table. Now I want this same functionality in new design as well.. The code logic fails when my tree is in fully collapsed manner.. ie I have 5 treeNodes under eachnode i have 10 children... When i collapse all this treenode, the layer count becomes 5 so my row index in the table is 1,2,3,4,5.. If the user selects 1st tree node and click on 'Insert Row', its adding my new row on 2nd index - my previous logic is 1. Get the position from MouseEvent and then rowIndex and add the new row at rowIndex+1...
But in tree i need to insert this new row at end of this particular treenode..

My Question is a) Is there any way to find the original index of that particular row, if all treenodes are collapsed?

If we hide a row, the row index of next row is not changing, so my code works fine with row hide show option.. but if i collapse the row indexes are changed and my logic fails....
Re: Finding row index in TreeLayer [message #1386413 is a reply to message #1386405] Tue, 17 June 2014 12:17 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2751
Registered: July 2012
Senior Member
If you are using GlazedLists (which I assume because of the tree representation) you need to operate on the underlying list instead of the TreeList. The TreeList transforms the underlying list, which means in your case, the children are removed from the TreeList representation. So there you don't get the original index. Instead you need to find the corresponding index in the underlying list representation for the element in the tree list.
Previous Topic:Unmovable Column (in GroupBy... table)
Next Topic:first column not showing correct values after ColumnReorder
Goto Forum:

Current Time: Thu Dec 12 23:50:17 GMT 2019

Powered by FUDForum. Page generated in 0.01816 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top