Jump to content

UniDBGrid MultiColumnSort


Recommended Posts

Hello,

Have you got a sample with unidbgrid and an Implementation of MultiColumnSort ?

The Event OnMulticolumnsort return always one column

 

Other question :

Have you got a sample for having 3 state for sorting column when click on column title.

First click = asc

second click = desc

third click = none

Link to comment
Share on other sites

  • 2 years later...

clientevents->unievents :

function beforeInit(sender, config) 
{
    config.multiColumnSort = true;
}

 On grid :

procedure TMainForm.MainGridMultiColumnSort(Columns: TUniDBGridColumnArr;
  Directions: TUniSortDirections);
var
  I: Integer;
  IndxFldNames: string;
begin
  IndxFldNames := '';
  fIdxStr:= '';
  //read the multisort
  for I := High(Columns) downto 0 do
  begin
    case Directions[I] of
      True :
        begin
          IndxFldNames := IndxFldNames + Columns[I].FieldName + ':A;';
          fIdxStr := fIdxStr + Columns[I].Title.Caption +' Ascendant, ';
        end;
      False:
        begin
          IndxFldNames := IndxFldNames + Columns[I].FieldName + ':D;';
          fIdxStr := fIdxStr + Columns[I].Title.Caption +' Descendant, ';
        end;
    end;
  end;
  //apply sort to dataset
  unimainmodule.MainQuery.IndexFieldNames := IndxFldNames;
end;
Link to comment
Share on other sites

I'm a bit confuse:

  • Why do you use fIdxStr for?
  • I was using this same method a few months ago in another project, without defining ClientDataSet1.IndexDefs and it was working fine.. but now when I pass IndxFldNames value to UniMainModule.ClientDataSet1.IndexFieldNames, I got a "EDatabaseError with message 'ClientDataSet1: Field 'City:A' not found". If I do not precise the ':A' or ':D' options, the error is not fired ..

Any idea ? What am I missing ?  :blink:  

Link to comment
Share on other sites

My bad then, I thought that UniMainModule.ClientDataSet1.IndexName propertie works only for monoSorting .. I could have find a workaround by myself !  <_<

 

Anyhow, I just notice that we can sort only three column: is it possible to sort more than 3 columns ?

 

Thanks, mister DelaGoutte  ^_^

Link to comment
Share on other sites

doc in sencha

active multisort :

http://docs.sencha.com/extjs/4.2.5/#!/api/Ext.grid.Panel-cfg-multiColumnSort

 

set limit (default 3):

http://docs.sencha.com/extjs/4.2.5/#!/api/Ext.data.Store-cfg-multiSortLimit

 

in unigui :

for limit at 10 

      aGrid.ClientEvents.ExtEvents.Values['store.load'] :=
      'function store.load(sender, records, successful, eOpts)'+#13#10+
      '{'+#13#10+
      '    sender.multiSortLimit=10;'+#13#10+
      '}';
Link to comment
Share on other sites

  • 3 years later...

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...