delagoutte Posted January 14, 2015 Posted January 14, 2015 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 Quote
delagoutte Posted October 10, 2017 Author Posted October 10, 2017 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; Quote
M477H13U Posted October 10, 2017 Posted October 10, 2017 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 ? Quote
delagoutte Posted October 10, 2017 Author Posted October 10, 2017 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 Quote
M477H13U Posted October 10, 2017 Posted October 10, 2017 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 Quote
delagoutte Posted October 10, 2017 Author Posted October 10, 2017 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+ '}'; Quote
x11 Posted April 6, 2021 Posted April 6, 2021 On 10/10/2017 at 12:04 PM, delagoutte said: unimainmodule.MainQuery.IndexFieldNames := IndxFldNames; DevArt uniDac (UniQuery) is not support IndexFieldNames with SmartFetch Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.