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

sorry , it's a copy of my code.

fIdxStr is a gloval var that i use for display the current sort in the status bar for inform user.

 

I'm using firedac and fdquery. See demo gridcolumnsort for apply a sort with cliendataset and adapt my code

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...
On 10/10/2017 at 12:04 PM, delagoutte said:

unimainmodule.MainQuery.IndexFieldNames := IndxFldNames;

DevArt uniDac (UniQuery) is not support IndexFieldNames with SmartFetch :(

Screenshot_3.jpg

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