Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002914 [JEDI VCL] 00 JVCL Components minor always 2005-04-27 02:31 2006-01-24 02:19
Reporter ivan_ra View Status public  
Assigned To AHUser
Priority normal Resolution fixed  
Status resolved   Product Version 3.00
Summary 0002914: TJvDBTreeView - working with BIG trees
Description TJvDBTreeView performs unnessesary updates of tree. When tree is small it is not big problem, but with big trees its takes significant time.
Cause of trouble is in
procedure TJvCustomDBTreeView.DataChanged;
...
        if (RecCount = -1) or (RecCount <> OldRecCount) then
          UpdateTree;
...
Value of OldRecCount is othen wrong.
This is is solution for some cases:

procedure TJvCustomDBTreeView.RefreshChild(ANode: TJvDBTreeNode);
...
  if ANode=nil then
    oldRecCount := FDataLink.DataSet.RecordCount; // ivan_ra
end;

procedure TJvCustomDBTreeView.UpdateTree;
...
  oldRecCount := FDataLink.DataSet.RecordCount; // ivan_ra
end;

Additional Information
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0007181)
obones (administrator)
2005-05-18 05:50

Please try with the latest version of the JVCL from CVS as there were improvements made to the treeviews. Let us know how it goes.
(0007409)
ivan_ra (developer)
2005-06-06 23:22

I looked in source-latest.zip. Problem is remains.
For example:
1. I insert new record into tree;
2. I call UpdateTree method. On big tree it takes some time;
3. After that I try to browse tree.
And now lets see what happens in code:
1. Invokes DataChanged method and OldRecCount becomes -1
2. Tree updated but still OldRecCount = -1
3. once again invokes DataChanged method and because OldRecCount = -1 tree updates again.
With my fixes in clause 2 oldRecCount becomes = FDataLink.DataSet.RecordCount, so in clause 3 tree not updates

RefreshChild(nil) is just as UpdateTree
(0008423)
ivan_ra (developer)
2006-01-23 07:46

oldRecCount simple means old known count of records in dataset. This field uses as criteria when we want to know, is tree changed or not (look at DataChanged code). When tree rebuilded, we can tell with confidence: contents of dataset and tree identical.
Tree entirely updates in procedures UpdateTree and RefreshChild(nil). So, when we successfully exit fom this procedures, we can assume what we do not need to update tree again. Therefore I suggest to add this code to the end of this procedures:
oldRecCount := FDataLink.DataSet.RecordCount

procedure TJvCustomDBTreeView.RefreshChild(ANode: TJvDBTreeNode);
...
  if ANode=nil then
    oldRecCount := FDataLink.DataSet.RecordCount;
end;

procedure TJvCustomDBTreeView.UpdateTree;
...
  oldRecCount := FDataLink.DataSet.RecordCount;
end;

This 3 strings can save sugnificant amount of time for user browsing BIG tree
(0008438)
AHUser (developer)
2006-01-24 02:19

Fixed in CVS.

- Issue History
Date Modified Username Field Change
2005-04-27 02:31 ivan_ra New Issue
2005-05-18 05:50 obones Note Added: 0007181
2005-05-18 05:50 obones Status new => feedback
2005-06-06 23:22 ivan_ra Note Added: 0007409
2006-01-23 07:46 ivan_ra Note Added: 0008423
2006-01-24 02:19 AHUser Status feedback => resolved
2006-01-24 02:19 AHUser Resolution open => fixed
2006-01-24 02:19 AHUser Assigned To => AHUser
2006-01-24 02:19 AHUser Note Added: 0008438


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker