Filter on Close/Open

9 views
Skip to first unread message

Alejandro AG

unread,
May 28, 2025, 11:45:32 AMMay 28
to Rosi Delphi Components
I'm having a problem with filter on rDBGrid

I need to reopen to be sure of fresh data, but may be the rDBGrid has some filter active at the moment,  I do:
Query.Close; 
Query.Open;

(I don't know if some other way to refresh all data and calculated fields, not only actual one)

This moment, the Filtered is False, and Filter is Empty, but row of filtering in grid still containing values.
Some way to reactivate the filter just after Open?

Tks for the clue or idea to resolve it.

Tomas Rosinsky

unread,
Jun 8, 2025, 5:08:43 PMJun 8
to Rosi Delphi Components
Hi,

rDBGrid does not filter any data, it only set dataset filter string according to funnel filter or text filter values.
rDBGrid also is not notified automatically if dataset filter is manually updated or reset by dataset Close/Open action.

So possible solution is easy and depends on what do you need.

If you want to just update rDBGrid to show current filter status then you have to add custom code after opening of dataset:

    { notify rDBGrid that filter was changed externally, funnel state and filter list is updated }
    procedure FilterChangedNotification;
 
If you want to set dataset filter accrding to current column filter, then you use following:

    { return actual filter string defined by ColumnFilters }
    function GetColumnFilterString: string;

add custom code after opening of dataset:
 
    rdbtool.SetFilterString(DataSet, rDBGrid.GetColumnFilterString, false);

I hope it helps
Tomas
Dne středa 28. května 2025 v 17:45:32 UTC+2 uživatel aag.co...@gmail.com napsal:
Reply all
Reply to author
Forward
0 new messages