@@ -32,7 +32,7 @@ import { withMethodExposing } from "comps/generators/withMethodExposing";
32
32
import { MAP_KEY } from "comps/generators/withMultiContext" ;
33
33
import { NameGenerator } from "comps/utils" ;
34
34
import { trans } from "i18n" ;
35
- import _ from "lodash" ;
35
+ import _ , { isArray } from "lodash" ;
36
36
import {
37
37
changeChildAction ,
38
38
CompAction ,
@@ -661,6 +661,41 @@ TableTmpComp = withMethodExposing(TableTmpComp, [
661
661
}
662
662
} ,
663
663
} ,
664
+ {
665
+ method : {
666
+ name : "setMultiSort" ,
667
+ description : "" ,
668
+ params : [
669
+ { name : "sortColumns" , type : "arrayObject" } ,
670
+ ] ,
671
+ } ,
672
+ execute : ( comp , values ) => {
673
+ const sortColumns = values [ 0 ] ;
674
+ if ( ! isArray ( sortColumns ) ) {
675
+ return Promise . reject ( "setMultiSort function only accepts array of sort objects i.e. [{column: column_name, desc: boolean}]" )
676
+ }
677
+ if ( sortColumns && isArray ( sortColumns ) ) {
678
+ comp . children . sort . dispatchChangeValueAction ( sortColumns as SortValue [ ] ) ;
679
+ }
680
+ } ,
681
+ } ,
682
+ {
683
+ method : {
684
+ name : "getMultiSort" ,
685
+ description : "" ,
686
+ params : [ ] ,
687
+ } ,
688
+ execute : ( comp ) => {
689
+ // const sortColumns = values[0];
690
+ // if (!isArray(sortColumns)) {
691
+ // return Promise.reject("setMultiSort function only accepts array of sort objects i.e. [{column: column_name, desc: boolean}]")
692
+ // }
693
+ // if (sortColumns && isArray(sortColumns)) {
694
+ // comp.children.sort.dispatchChangeValueAction(sortColumns as SortValue[]);
695
+ // }
696
+ return Promise . resolve ( comp . children . sort . getView ( ) ) ;
697
+ } ,
698
+ } ,
664
699
{
665
700
method : {
666
701
name : "resetSelections" ,
@@ -847,6 +882,18 @@ export const TableComp = withExposingConfigs(TableTmpComp, [
847
882
} ,
848
883
trans ( "table.sortColumnDesc" )
849
884
) ,
885
+ new DepsConfig (
886
+ "sortColumns" ,
887
+ ( children ) => {
888
+ return {
889
+ sort : children . sort . node ( ) ,
890
+ } ;
891
+ } ,
892
+ ( input ) => {
893
+ return input . sort ;
894
+ } ,
895
+ trans ( "table.sortColumnDesc" )
896
+ ) ,
850
897
depsConfig ( {
851
898
name : "sortDesc" ,
852
899
desc : trans ( "table.sortDesc" ) ,
0 commit comments