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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...