in documentation you wrote that on the FNCDataGrid OnAfterApplyFilter event you can cast the sender object to a TTMSFNCDataGrid object but it seems to be an error because the object is of type TTMSFNCDataGridRenderer.
procedure TForm1.TMSFNCDataGrid1AfterApplyFilter(Sender: TObject; AColumn: Integer; ACondition: string);
var
Grid: TTMSFNCDataGrid;
Total, Visible: Integer;
begin
Grid := Sender as TTMSFNCDataGrid; // <- ERROR here
Total := Grid.RowCount - Grid.FixedRowCount;
Visible := Grid.VisibleRowCount;
...
Also, on FNCDataGrid, if I enable the count of records as in
the result is wrong: on column 1 I see 611 but the records in table are 612 and I have no filters. On the other side, OnAfterApplyFilter grid the “Total” is the right one (612), but if I play with grouping and de-grouping columns sometimes the footer changes to 612.
All components are in the latest version avalaible.
Thanks for pointing that out, we’ll fix the documentation. About the calculations, did you apply this to one of our demos? Can you maybe provide some more insight or a small sample demonstrating the issue?
var
grid: TTMSFNCDataGridRenderer;
begin
grid := (sender as TTMSFNCDataGridRenderer);
var LTotal: integer := Grid.RowCount - Grid.FixedRowCount;
var LVisible: integer := Grid.VisibleRowCount;
showmessage(LVisible.ToString + ' on ' + LTotal.ToString);
to your FilterRow sample.
If you filter for 120 hp, you see only 6 rows on the grid (Audi, BMW and Chrysler), so I expect to have 6 (visible) on 112 (total), but you have as result 139 on 152 when the data rows on the .csv file are 112…
The count error of my first message was on a test form I’m working on and I need some time to create a working sample without my data in it because it uses a PostgreSQL database. So I’ll try to use a local dataset to duplicate the issue.
The amount of visible rows includes node & summary rows.
You can use this code:
procedure TForm130.TMSFNCDataGrid1AfterApplyFilter(Sender: TObject;
AColumn: Integer; ACondition: string);
var
grid: TTMSFNCDataGridRenderer;
I: Integer;
begin
grid := (sender as TTMSFNCDataGridRenderer);
var K: Integer := 0;
for I := TMSFNCDataGrid1.FixedRowCount to TMSFNCDataGrid1.RowCount - 1 do
begin
if TMSFNCDataGrid1.IsRowNormal(i) and not TMSFNCDataGrid1.IsRowFiltered(i) then
Inc(K);
end;
TTMSFNCUtils.Log('Filtered Rows: ' + K.ToString);
end;
Running the app I have 611 as total rows (but I have 612 customers). If I change the FixedBottomRowCount to 2, I have 610 as total rows.
On the Group event of the grid I have also a CreateGroupColumnCalculation, and it shows the right values.
It seems also that not using the data adapter (like it’s in my applicatioon) but reading your cars.csv as a sample, it shows 112 that is the right count for the rows of the csv file.
You’re right! I’ve changed the setting and put it before opening the dataset and it works correctly.
One last question: will you implement a “global” search valid for all values in every column of the row or it’s a thing that must be implemented programmatically?