Drop a TTMSFNCGrid in a form with 2 Tbutton and 1 Tmemo
Use the following code:
procedure TForm2.FormShow(Sender: TObject);
var n,m:integer;
begin tabl.FixedColumns:=1; tabl.FixedRows:=1; tabl.RowCount:=20; tabl.ColumnCount:=15;
for m:=0 to tabl.ColumnCount-1 do begin tabl.Columns.Items[m].Name:='col '+m.ToString;
for n:=0 to tabl.RowCount-1 do if m=1 then tabl.Cells[m,n]:=(n mod 2).ToString
else tabl.Cells[m,n]:=m.ToString+':'+n.ToString;
end; end;
procedure TForm2.shlog(const s: string);
begin memo1.Lines.Add(s); end;
procedure TForm2.Button1Click(Sender: TObject);
begin
tabl.RemoveFilters;
tabl.HideColumn(2);
shlog(tabl.ColumnCount.ToString+'/'+tabl.TotalColCount.ToString);
shlog('all cells:'+tabl.AllCells[2,2]);
shlog('cells: '+tabl.Cells[2,2]);
shlog(tabl.Columns.Items[2].Name);
end;
procedure TForm2.Button2Click(Sender: TObject);
begin tabl.Group(1); end;
Run the program, and click: Button2
After that collapse with the mouse the first row as in the following image:
Because the row is hidden, row with number 2 is actually no longer existing, so you are hiding a different row. Please use the following code to hide the actual row:
I have found also another problem that it should be a bug:
try to group by the last column, then hide the previous column from that you used to group.
Now try to ungroup and you will get an error
The information required to use RealToDisplRow & DisplToRealRow is missing when grouping. We'll need to allocate more time in order to investigate what exactly is going wrong.
How can I set the column that the name of grouping value will be shown in grouping?
For the moment, the node is in column 0 and the grouping value is shown on column 1 and that causes problems to autocolumn sizing.
Can I merge the column 0 and 1 (node & grouping value) for the rows that show the grouping and how?