The grid is completely virtual, meaning no data stored inside the grid but in external objects, cell values are provided via onGetDisplText.
There is a GridDropDown with 3 columns, corresponding to 3 columns of the grid which are declared as AEditor := edGridDropDown. In onGetEditorProp I'm setting the grid.GridDropDown.LookupColumn to the respective column.
The GridDropDown is populated with static data using grid.GridDropDown.Items.Add. Depending on other information set in different columns I want the GridDropDown to be filtered - before the dropdown happens, and after user inputs data to narrow the selection down.
To filter the GridDropDown, I'm using this function:
procedure Tprodplanform.filterplangridDropdown(anlage: Integer; artikelnr,
bezeichnung: String);
begin
with plangrid.GridDropDown.FGrid do begin
filter.Clear;
filteractive := False;
if artikelnr <> '' then with filter.add do begin
condition := '*'+artikelnr+'*';
CaseSensitive := false;
column := 0;
end;
if bezeichnung <> '' then with filter.add do begin
condition := '*'+bezeichnung+'*';
CaseSensitive := false;
column := 1;
end;
with filter.add do begin
condition := '*A'+inttostr(anlage)+'B*';
CaseSensitive := false;
column := 3;
end;
filteractive := true;
end;
end;
I'm calling this function in
procedure Tprodplanform.plangridSetEditText(Sender: TObject; ACol,
ARow: Integer; const Value: string);
begin
if Acol in [12,13] then begin
if (ACol=12) then filterplangridDropdown(gl[ARow].Anlage, '', value);
if (ACol=13) then filterplangridDropdown(gl[ARow].Anlage, value, '');
end;
end;
as well as in plangrid.GridDropDown.OnBeforeDropDown.
Can you give me a hint on what I'm doing wrong here, or do you need a demo project? Thanks in advance!