Link to home
Start Free TrialLog in
Avatar of hrvica5
hrvica5Flag for Croatia

asked on

delphi sorting, treeview

I have table (attach) like this i should sorted in treeview

how should I put it in attach

if ParentID is null that row is firstnode in treeview
if row has ParentId then it is under same id

Thx, Hrvica
sort.xls
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

No need to use parentId. I made new example in this topic:
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_28339711.html#a39790506
Searching in tree is going with strings and not integer value.
Avatar of hrvica5

ASKER

Thank you very much for soultions but I have 2 problems

TUC is ok,
but under first node BRE, it is not OK (treeview.jpg)

2. If I have more than cca. 1000 rows it is slow (duration.jpg)


Thank you very much and sory, Hrvica
TreeView.jpg
duration.jpg
Avatar of jimyX
jimyX

I see why you needed the AbsoluteIndex for...

But one thing to consider, of course depending on what you are doing, there might be better solution for storing/retrieving nodes to/from DB Tables.

For instance you could use SaveToStream and LoadFromStream to put/get your nodes back and forth from the DB.

If you need to populate the TreeView from the DB line by line, well for big number of records, "you can negotiate your tax but you can not get exempted". There is no way that you can eliminate the time overhead (reading the lines to plot them in the TreeView takes time). Could be reduced but it can't be eliminated completely.
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hrvica5

ASKER

Thank you, Hrvica