@@ -32,7 +32,7 @@ import { withMethodExposing } from "comps/generators/withMethodExposing";
3232import { MAP_KEY } from "comps/generators/withMultiContext" ;
3333import { NameGenerator } from "comps/utils" ;
3434import { trans } from "i18n" ;
35- import _ from "lodash" ;
35+ import _ , { isArray } from "lodash" ;
3636import {
3737 changeChildAction ,
3838 CompAction ,
@@ -661,6 +661,41 @@ TableTmpComp = withMethodExposing(TableTmpComp, [
661661 }
662662 } ,
663663 } ,
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+ } ,
664699 {
665700 method : {
666701 name : "resetSelections" ,
@@ -847,6 +882,18 @@ export const TableComp = withExposingConfigs(TableTmpComp, [
847882 } ,
848883 trans ( "table.sortColumnDesc" )
849884 ) ,
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+ ) ,
850897 depsConfig ( {
851898 name : "sortDesc" ,
852899 desc : trans ( "table.sortDesc" ) ,
0 commit comments