Home > Back-end >  Delphi DBGrid sort very simple
Delphi DBGrid sort very simple

Time:10-24

Write the following code in the DBGrid event TitleClick,
I am using MemTableEh, you can according to their own habits, look with which the return value is the DataSet control, no matter which should have its think should sorting method, such as the following written to OK, didn't they say write so trouble

If the Copy (MemTableEh1 SortOrder, Length (Column. FieldName) + 2, 1)='A' then
MemTableEh1. SortOrder:=Column. FieldName + 'DESC'
The else
MemTableEh1. SortOrder:=Column. FieldName + 'ASC';

CodePudding user response:

LZ good comrade!!!!!!

CodePudding user response:

The
refer to the original poster simon444 response:
write the following code in the DBGrid event TitleClick,
I am using MemTableEh, you can according to their own habits, look with which the return value is the DataSet control, no matter which should have its think should sorting method, such as the following written to OK, didn't they say write so trouble

If the Copy (MemTableEh1 SortOrder, Length (Column. FieldName) + 2, 1)='A' then
M...
to learn

CodePudding user response:

After ehlib5.0 version has the function of the built-in sort, no longer need some code,

CodePudding user response:

Sorting thank you
Dbgrid sorting

CodePudding user response:

reference JINTIANBUXIAYU1 reply: 3/f
after ehlib5.0 version has the function of the built-in sort, no longer need some code,


Can you give a don't have to write code component package installation for me, I was 2010, thank you

CodePudding user response:

DevExpress cxGrid in very powerful!

CodePudding user response:

reference JINTIANBUXIAYU1 reply: 3/f
after ehlib5.0 version has the function of the built-in sort, no longer need some code,

Can realize automatic sorting,

CodePudding user response:

  • Related