Added the following code so these will only be available to set.
procedure TBOMForm.BOMDATAGRIDNeedFilterDropDownData(Sender: TObject;
AColumn: Integer; AValues: TStrings);
begin
if AColumn = 1 then
begin
AValues.Clear;
AValues.Add('All');
AValues.Add('Vicksburg');
AValues.Add('Charlotte');
end;
end;
I tried adding this code to force the filter drop down to show checkbox true for Vicksburg and for Charlotte but it filtered correctly but Vicksburg is only checked in the filter dropdown list.
So, how to set the checkboxes true on the filter drop down list?
procedure TForm1.bomDataGridNeedFilterDropDownData(Sender: TObject;
AColumn: Integer; AValues: TStrings);
begin
if AColumn = 1 then
begin
AValues.Clear;
AValues.Add('All');
AValues.Add('Charlotte');
AValues.Add('Vicksburg');
end
else
if AColumn = 7 then
begin
AValues.Clear;
AValues.Add('All');
AValues.Add('10332');
AValues.Add('50');
AValues.Add('m 49');
AValues.Add('m 50');
AValues.Add('m 51');
AValues.Add('49');
AValues.Add('51');
AValues.Add('50');
end;
end;
When the app opens, I only want Avalues '50' or '51' to be checked in filter dropdown values with the other avalues not checked in there checkbox and not included in the filter fdtable when it opens. So in the acolumn 7 above how to program this to happen?
Thanks
Garnett
Effectively, this means that you need to apply a filter then programmatically? Because, when only the values 50 / 51 are checked, this means that visually, the filter should match.
So, the above filters will show in the Filter drop down list but ‘50’ and ‘51’ will be checked and filtered when it is opened. Yes, how do I programmatically remove the filter by setting the checkboxes to false for them so they do not filter the data?
Forgive my ignorance but I still don’t get it. If 50 and 51 is checked, then it visually represents a filter which should then only show 50 and 51, hence the other values are unchecked. If you then would check one of the other values, the values should appear alongside the already checked 50 & 51. Because if they are unchecked and the filter does not represent what is being checked, then checking them would actually do nothing? I’m trying to understand where you are going to.
Either way, you can use this code to uncheck them without applying a filter:
procedure TForm10.TMSFNCDataGrid1CustomizeFilterPopupEditor(Sender: TObject;
AColumn: Integer; var AEditor: TTMSFNCDataGridCellControl);
var
l: TTMSFNCListBoxItem;
begin
for l in TMSFNCDataGrid1.Root.FilterListBox.Items do
l.Checked := (l.Text = '50') or (l.Text = '51');
end;
I put together a test app to show my issue with the dropdown filter using to app and database attached.
When I run the app the app formshow procedure add three filter values, however, the the dropdown filter on column 7 shows only ‘49’ value is checked but it filtered all three values. .
Your code:
TMSFNCDataGrid1CustomizeFilterPopupEditor
did make the dropdown checkbox to true, but it did not filter it.
Thanks
Garnett
Ah, now I see and understand. Thank you for the sample! This is an issue in TMS FNC Data Grid. I’m currently looking into it. In the mean time, you need to change the code to: