[probably off-topic on]
I don't think that I'm really understanding what you're trying to do (generally, when we click on a header-title, it's to change the SQL 'ORDER BY' underneath, or change the dataset.IndexName used). Anyway, without "header's popup solution" (sorry), if you want to
"filter" according the columns-fields displayed in your grid, you could put a TPanel on the top of the grid. Then:
- dynamically create some TLabeledEdit, having for TLabel.caption the titles of your columns-fields of the grid.
- on each TLabeledEdit.onChange event, you could modify the query of your grid:
with grdFoo.datasource.dataset do begin
Close;
SQL.Clear;
SQL:= 'SELECT ' + edtField1.label.caption + ', ' + edtField2.label.caption + ', ' + ...\... + ' FROM tbl_foo';
if (edtField1.text<>'') or (edtField2.text<>'') or ...\... then begin
SQL.Add('WHERE');
if (edtField1.text<>'') then
SQL.Add(edtField1.label.caption + ' LIKE "%' + edtField1.text + '%"');
if (edtField2.text<>'') then
SQL.Add('AND ' + edtField2.label.caption + ' LIKE "%' + edtField2.text + '%"');
...\...
end;
Open;
end;
[probably off-topic off]