code cleaning
This commit is contained in:
parent
64748bd76d
commit
e1b3afd543
1 changed files with 0 additions and 10 deletions
|
|
@ -401,7 +401,6 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
|
||||||
|
|
||||||
const columnClick = (column: Column<T>) => {
|
const columnClick = (column: Column<T>) => {
|
||||||
const sortKey = column.sortKey ? column.sortKey : column.title.toLowerCase()
|
const sortKey = column.sortKey ? column.sortKey : column.title.toLowerCase()
|
||||||
// console.log(column.sortKey)
|
|
||||||
if (setOrderBy) {
|
if (setOrderBy) {
|
||||||
if (orderBy === sortKey && setOrder && order) {
|
if (orderBy === sortKey && setOrder && order) {
|
||||||
if (order === "desc") {
|
if (order === "desc") {
|
||||||
|
|
@ -409,13 +408,11 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
|
||||||
} else {
|
} else {
|
||||||
setOrderBy("")
|
setOrderBy("")
|
||||||
}
|
}
|
||||||
// setOrder(order === "asc" ? "desc" : "asc")
|
|
||||||
} else {
|
} else {
|
||||||
if (setOrder) setOrder("desc")
|
if (setOrder) setOrder("desc")
|
||||||
setOrderBy(sortKey)
|
setOrderBy(sortKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (setOrder && order) setOrder(order === "asc" ? "desc" : "asc")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const showOrderIcon = (column: Column<T>) => {
|
const showOrderIcon = (column: Column<T>) => {
|
||||||
|
|
@ -439,9 +436,6 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
|
||||||
newWidths.push(node.clientWidth)
|
newWidths.push(node.clientWidth)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log(index)
|
|
||||||
console.log(newWidths.length)
|
|
||||||
console.log(newWidths)
|
|
||||||
|
|
||||||
rowWidthsRef.current = newWidths
|
rowWidthsRef.current = newWidths
|
||||||
dragIndexRef.current = index;
|
dragIndexRef.current = index;
|
||||||
|
|
@ -467,11 +461,8 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
|
||||||
if (rowWidths[index+1] === undefined) return
|
if (rowWidths[index+1] === undefined) return
|
||||||
if (!dragStart) return
|
if (!dragStart) return
|
||||||
|
|
||||||
console.log("dragging")
|
|
||||||
|
|
||||||
let newWidths: number[] = [...rowWidths]
|
let newWidths: number[] = [...rowWidths]
|
||||||
newWidths[index] = newWidths[index] - (dragStart - e.clientX)
|
newWidths[index] = newWidths[index] - (dragStart - e.clientX)
|
||||||
// newWidths[index+1] = newWidths[index+1] + (dragStart - e.clientX)
|
|
||||||
newWidths.every((width, j) => {
|
newWidths.every((width, j) => {
|
||||||
if (j <= index || width === 0) return true
|
if (j <= index || width === 0) return true
|
||||||
else if (newWidths[j] !== undefined) {
|
else if (newWidths[j] !== undefined) {
|
||||||
|
|
@ -612,7 +603,6 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
|
||||||
}
|
}
|
||||||
{columns ?
|
{columns ?
|
||||||
columns.map((column, j) => {
|
columns.map((column, j) => {
|
||||||
// console.log(j)
|
|
||||||
if (filterList.includes(column.title) || column.hidden) return (
|
if (filterList.includes(column.title) || column.hidden) return (
|
||||||
<TableCell key={"row-"+index+"cell-"+j} sx={{ width: 0, padding: 0, margin: 0}}></TableCell>
|
<TableCell key={"row-"+index+"cell-"+j} sx={{ width: 0, padding: 0, margin: 0}}></TableCell>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue