If you configure your grid to have Column Filter Dropdowns
Options.Filtering.DropDown := True;
Options.Filtering.MultiColumn := True;
then you get a list of all values in the grid (for that column).
That's great.
But if you use the dropdown filter on another column you get also a list of ALL values for that column.
That seems ok, but due to the 1st filter probably only a few values are left.
And I would expect (for a non-filtered column) that only the values that remain are visible in the dropdown list.
I can change this myself when I override the DoNeedFilterDropDownData method, but that's highly inefficient due to the fact that things are done twice.
It would be better if this was a feature of the TMSFMXGrid component (maybe based on a property).
if (Cell is TTMSFMXFixedGridCell) and (Options.Filtering.DropDown) and (Options.Filtering.DropDownFixedRow = ARow) and ((Cell as TTMSFMXFixedGridCell).PopupControl = FilterListBox) then
begin
sl := TStringList.Create;
try
sl.Duplicates := dupIgnore;
sl.Sorted := True;
sl.Add(sTMSFMXGridFilterAll);
c := DisplToRealColumn(ACol);
if Filter.HasFilter(c) then
begin
for i := FixedRows to RowCount - FixedFooterRows - 1 + HiddenRowCount do
begin
s := AllCells[c, i];
s := Trim(s);
sl.Add(s);
end;
end
else
begin
for i := FixedRows to RowCount - FixedFooterRows - 1 do
begin
s := Cells[c, i];
s := Trim(s);
sl.Add(s);
end;
end;
DoNeedFilterDropDownData(c, ARow, sl);
((Cell as TTMSFMXFixedGridCell).PopupControl as TListBox).BeginUpdate;
((Cell as TTMSFMXFixedGridCell).PopupControl as TListBox).Items.Assign(sl);
((Cell as TTMSFMXFixedGridCell).PopupControl as TListBox).ItemIndex := -1;
((Cell as TTMSFMXFixedGridCell).PopupControl as TListBox).EndUpdate;
((Cell as TTMSFMXFixedGridCell).PopupControl as TListBox).Tag := ACol;