Jump to content

UniDBGrid column sorting


Skepsis IT

Recommended Posts

Hi to all Unigui Community,

 

after a research on the forum I don't find how to sort columns on unidbgrid. There is a demo that does it but no source code. Moreover I enabled the option sortable, menu is enabled, but does not sort anything.

 

Thanks for your time.

Link to comment
Share on other sites

Hi,

 

it is very easy, in the OnColumnSort Event

simply made a new query the direction you want.

hi Gerhard  and others or advance

i want each column sortable,  at time properties -> Sortable:=true; but couldn't sorting

 

 I use this query to show data ,

 

SELECT *, concat(desitem,' ',unit,' isi ',unitqty) as desitemdisplay,

concat(codeitem,'-',desitem,' ',unit,' isi ',unitqty  ) as codedisplay

FROM (tbllistitem1 itm1 INNER JOIN tblitemwh itmwh on

itm1.iditem=itmwh.iditem) INNER JOIN tblcodewh codewh on

itmwh.idcode=codewh.idcode WHERE itmwh.codeitem LIKE '%MR%' order by codewh.descode asc, itmwh.codeitem asc

 

bold characters are currently sorting.

 

Pls help me, thank before

 

 

Has

Link to comment
Share on other sites

 



procedure TIndSourceFrame.IndSourceGridColumnSort(Column: TUniDBGridColumn;
  Direction: Boolean);
begin
  if not (IndSourceQuery.Eof and IndSourceQuery.Bof) then
    begin
      if SameText(Column.FieldName, 'IND_SRC_CODE') then
        begin
          if Direction then
            IndSourceQuery.IndexFieldNames := Column.FieldName + ' asc'
          else
            IndSourceQuery.IndexFieldNames := Column.FieldName + ' desc'
        end;
      if SameText(Column.FieldName, 'IND_SRC_NAME') then
        begin
          if Direction then
            IndSourceQuery.IndexFieldNames := Column.FieldName + ' asc'
          else
            IndSourceQuery.IndexFieldNames := Column.FieldName + ' desc'
        end;
      if SameText(Column.FieldName, 'RASH_TYPE') then
        begin
          if Direction then
            IndSourceQuery.IndexFieldNames := Column.FieldName + ' asc'
          else
            IndSourceQuery.IndexFieldNames := Column.FieldName + ' desc'
        end;
      if SameText(Column.FieldName, 'SHOW_TYPE') then
        begin
          if Direction then
            IndSourceQuery.IndexFieldNames := Column.FieldName + ' asc'
          else
            IndSourceQuery.IndexFieldNames := Column.FieldName + ' desc'
        end;
    end;
end;

  • Upvote 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...