fix sorting table list
This commit is contained in:
parent
2ae5e5e90b
commit
56207c33fd
|
|
@ -28,6 +28,7 @@ import { filterWhere } from "../filter/parser/filter-where";
|
|||
import { getFilter } from "../filter/utils/get-filter";
|
||||
import { Skeleton } from "../ui/skeleton";
|
||||
import { sortTree } from "./utils/sort-tree";
|
||||
import { set } from "lib/utils/set";
|
||||
|
||||
type OnRowClick = (arg: {
|
||||
row: any;
|
||||
|
|
@ -151,8 +152,13 @@ export const TableList: FC<TableListProp> = ({
|
|||
local.sort.columns = cols;
|
||||
local.paging.skip = 0;
|
||||
if (cols.length > 0) {
|
||||
const { columnKey, direction } = cols[0];
|
||||
let { columnKey, direction } = cols[0];
|
||||
|
||||
if (columnKey.includes(".")) {
|
||||
let root: any = {};
|
||||
set(root, columnKey, direction === "ASC" ? "asc" : "desc");
|
||||
local.sort.orderBy = root;
|
||||
} else {
|
||||
let should_set = true;
|
||||
const gf = JSON.stringify(gen_fields);
|
||||
const fields = fields_map.get(gf);
|
||||
|
|
@ -186,6 +192,7 @@ export const TableList: FC<TableListProp> = ({
|
|||
[columnKey]: direction === "ASC" ? "asc" : "desc",
|
||||
};
|
||||
}
|
||||
}
|
||||
} else {
|
||||
local.sort.orderBy = null;
|
||||
}
|
||||
|
|
@ -417,7 +424,7 @@ export const TableList: FC<TableListProp> = ({
|
|||
row={props.row}
|
||||
col={{
|
||||
name: props.column.key,
|
||||
value: props.row[props.column.key],
|
||||
value: get(props.row, props.column.key),
|
||||
depth: props.row.__depth || 0,
|
||||
}}
|
||||
rows={local.data}
|
||||
|
|
@ -448,7 +455,7 @@ export const TableList: FC<TableListProp> = ({
|
|||
row={props.row}
|
||||
col={{
|
||||
name: props.column.key,
|
||||
value: props.row[props.column.key],
|
||||
value: get(props.row, props.column.key),
|
||||
depth: props.row.__depth || 0,
|
||||
}}
|
||||
rows={local.data}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ export const logout = (url_login?: string) => {
|
|||
localStorage.removeItem("user" + id_site);
|
||||
}
|
||||
if (url_login !== getPathname()) {
|
||||
console.log(url_login, getPathname());
|
||||
// location.href = `${getBasename()}${url_login}`;
|
||||
location.href = `${getBasename()}${url_login}`;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue