View Issue Details

IDProjectCategoryView StatusLast Update
0002914JEDI VCL00 JVCL Componentspublic2006-01-24 02:19
Reporterivan_raAssigned ToAHUser 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.00 
Target VersionFixed in Version3.20 
Summary0002914: TJvDBTreeView - working with BIG trees
DescriptionTJvDBTreeView 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;

TagsNo tags attached.

Activities

obones

2005-05-18 05:50

administrator   ~0007181

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.

ivan_ra

2005-06-06 23:22

developer   ~0007409

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

ivan_ra

2006-01-23 07:46

developer   ~0008423

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

AHUser

2006-01-24 02:19

developer   ~0008438

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