add function correct fcn express to sort in accending order

This commit is contained in:
Gibson Han
2022-02-10 17:55:10 +07:00
parent 3eea8a2c9d
commit 2efc7655f4

View File

@@ -157,7 +157,6 @@ const useTableConfig = (tableId?: string) => {
*/
const remove = (key: string) => {
const { columns } = tableConfigState;
/**
* Filter column, and remove key index
* Sort and reorder column
@@ -165,7 +164,7 @@ const useTableConfig = (tableId?: string) => {
*/
const updatedColumns: any = Object.values(columns)
.filter((c: any) => c.key !== key)
.sort((c: any) => c.index)
.sort((a: any, b: any) => a.index - b.index)
.reduce((acc: any, curr: any, index: any) => {
acc[curr.key] = { ...curr, index };
return acc;