CodePudding user response:
Ehlib tryCodePudding user response:
Tried, without an attribute, is expected to be writtenCodePudding user response:
The purpose of the drop-down? Choose a different value, sort, or filter?Sorting and filtering is some,
CodePudding user response:
Filter function, the column values displayed by the drop-down, then check the column values which needCodePudding user response:
Dbgrideh with his memory table and cxgrid has this functionCodePudding user response:
CxGridCodePudding user response:
Dbgrideh and cxgrid have this function, at the same time the DBGrid can do, but is more complex,Dbgrideh:
1, USES EhLibAdo; (if the client use ADO controls);
2, set the Column DBGridEh TitleButton attribute to True;
3, set DBGridEh OptionsEh dghAutoSortMarking attribute to True;
4, set DBGridEh SortLocal attribute to True,
CodePudding user response:
Dbgrideh:1, USES EhLibAdo; (if the client use ADO controls);
How to understand this, I tried the steps below, only out of the elevator sequence
CodePudding user response:
A sorting function:First in USES section according to the data set you choose corresponding reference EhLibXXX (EhLibADO, EhLibCDS...).
Then set the following a few DBGridEh properties of controls:
Procedure TForm1. FormCreate (Sender: TObject);
Var
I: Integer;
The begin
DBGridEh1. SortLocal:=True;
DBGridEh1. OptionsEh:=DBGridEh1. OptionsEh + [dghAutoSortMarking];
For I:=0 to DBGridEh1. Columns. Do the Count - 1
DBGridEh1. Columns [I]. Title. TitleButton:=True;
end;
Procedure TForm1. FormCreate (Sender: TObject);
Var I: Integer;
The begin
DBGridEh1. SortLocal:=True;
DBGridEh1. OptionsEh:=DBGridEh1. OptionsEh + [dghAutoSortMarking];
For I:=0 to DBGridEh1. Columns. Do the Count - 1
DBGridEh1. Columns [I]. Title. TitleButton:=True;
end;
Second, filtering functions:
Specific setup is very simple, is as follows:
DBGridEh1. STFilter. Visible:=True;
DBGridEh1. STFilter. Local:=True;
DBGridEh1. STFilter. Visible:=True; DBGridEh1. STFilter. Local:=True;
If you want to add custom filtering criteria in the drop-down list, can join in the corresponding column OnFillSTFilterListValues events:
Procedure TForm3. DBGridEh1Columns1FillSTFilterListValues (Sender: TCustomDBGridEh;
Column: TColumnEh; The Items: TStrings; Var Processed: Boolean);
The begin
The Items. The Add (' 201201 ');
The Items. The Add (' 201202 ');
The Items. The Add (' 201203 ');
The Items. The Add (' 201204 ');
end;
Three, automatic search:
The search box and can realize automatic search and filtering,
Delphi/Pascal DBGridEh1. SearchPanel. Enabled:=True;
DBGridEh1. SearchPanel. FilterOnTyping:=True;//real-time filtering
DBGridEh1. SearchPanel. Enabled:=True; DBGridEh1. SearchPanel. FilterOnTyping:=True;//real-time filtering