The way you are trying to use the grid's nodes is not the way it was designed for. You create nodes with one child that do not really have one (or more childs) and then dynamically add the childs when the node is expanded. The node expand / collaps events were not designed with this type of use in mind. We'd need to investigate if somehow it can be adapted so it can be used this way, but this is a non-trivial change.
Can you please contact us by email and send a sample source project where this issue is isolated so we can reproduce this here as I cannot see or reproduce this.
That began to deal with this problem and found the following.
The procedures ExpandNodeInt \ ContractNodeInt blocks of code have been added:
if IsNode(ARow) then
begin
for c := 0 to ColCount - 1 do
begin
obj := GridObjects[c,Arow];
if Assigned(obj) then
begin
cp := TCellProperties(obj);
cp.MergeCollaps := true;// or false in ExpandNodeInt
end;
end;
end;
This innovation is killing all the old functionality
Everything works fine up to version 7.8.3.1 or later,
until the input of these changes.
If you comment out the blocks, then everything works as before.
There is another problem, which has appeared in recent versions
When dynamically load nodes and then Expand/Contract of the last line is a loss.
The solution to this problem:
// function TAdvStringGrid.RemapRowInv(ARow: Integer): Integer;
............................
+// == begin 2014.05.11 (fixed hide last row)
+ FHiddenRowLookup.Free;
+ FHiddenRowLookup:=nil;
+// == end 2014.05.11
InitHiddenRowLookup;
full diff:
diff --git a/TmsComponents/advgrid.pas b/TmsComponents/advgrid.pas
index 610a2ef..eca3cb7 100644
--- a/TmsComponents/advgrid.pas
+++ b/TmsComponents/advgrid.pas
@@ -15336,18 +15336,20 @@ begin
else
Exit;
- if IsNode(ARow) then
- begin
- for c := 0 to ColCount - 1 do
- begin
- obj := GridObjects[c,ARow];
- if Assigned(obj) then
- begin
- cp := TCellProperties(obj);
- cp.MergeCollaps := false;
- end;
- end;
- end;
+// == begin 2015.10.13 (fixed column moving)
+// if IsNode(ARow) then
+// begin
+// for c := 0 to ColCount - 1 do
+// begin
+// obj := GridObjects[c,ARow];
+// if Assigned(obj) then
+// begin
+// cp := TCellProperties(obj);
+// cp.MergeCollaps := false;
+// end;
+// end;
+// end;
+// == end 2015.10.13
i := ARow + 1;
if (cg.CellIndex = 0) then
@@ -15419,19 +15421,20 @@ begin
Exit;
end;
- if IsNode(ARow) then
- begin
- for c := 0 to ColCount - 1 do
- begin
- obj := GridObjects[c,Arow];
- if Assigned(obj) then
- begin
- cp := TCellProperties(obj);
- cp.MergeCollaps := true;
- end;
- end;
- end;
-
+// == begin 2015.10.13 (fixed column moving)
+// if IsNode(ARow) then
+// begin
+// for c := 0 to ColCount - 1 do
+// begin
+// obj := GridObjects[c,Arow];
+// if Assigned(obj) then
+// begin
+// cp := TCellProperties(obj);
+// cp.MergeCollaps := true;
+// end;
+// end;
+// end;
+// == end 2015.10.13
i := ARow + 1;
@@ -18287,6 +18290,10 @@ begin
begin
//lh := nil;
//try
+// == begin 2014.05.11 (fixed hide last row)
+ FHiddenRowLookup.Free;
+ FHiddenRowLookup:=nil;
+// == end 2014.05.11
InitHiddenRowLookup;
while (k <= ARow) do