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?

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

We'll investigate.

1 Like

Any news?

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.

1 Like

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?

Hi,

You can do that via

  tabl.Options.Grouping.MergeHeader := True;
1 Like

I can confirm, the above has problems too, with grouping