TTMSFNCGrid and grouping column

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:


After that press button1 and expand the previous collapsed row. I am getting the following with the double row:

I just notice that after removing the

tabl.RemoveFilters;

it is not produced.
I am not sure what "tabl.RemoveFilters;" is expected to do

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:

tabl.HideColumn(tabl.DisplToRealRow(2));

1 Like

Lets adding a third button:

procedure TForm2.Button3Click(Sender: TObject);
begin
shlog(tabl.Cells[0,2]);
shlog(tabl.Cells[0,tabl.RealToDisplRow(2)]);
shlog(tabl.Cells[0,tabl.displTorealRow(2)]);
end;

running again the program, we press the button3 (no grouping)
I am getting:

Now, I press the button 2 to have grouping using column 1and again the button 3 and I am getting the following image:

Is the above correct?