chore: 테이블 columns 수정

This commit is contained in:
2025-07-01 14:18:58 +09:00
parent 0ef59a16f9
commit 19dd7a0091
4 changed files with 18 additions and 5 deletions
@@ -8,6 +8,12 @@ export const columns: ColumnDef<Post>[] = [
{
accessorKey: "rowNo",
header: "NO",
cell: ({ row, table }) => {
const totalRows = table.getRowCount();
const currentPage = table.getState().pagination.pageIndex;
const pageSize = table.getState().pagination.pageSize;
return totalRows - (currentPage * pageSize + row.index);
},
},
{
accessorKey: "pstTtl",
@@ -29,7 +29,7 @@ export const columns: ColumnDef<Post & { isUpndFixPost?: boolean }>[] = [
{
accessorKey: "rowNo",
header: "NO",
cell: ({ row }) => {
cell: ({ row, table }) => {
if (row.original.isUpndFixPost) {
return (
<Badge
@@ -40,7 +40,10 @@ export const columns: ColumnDef<Post & { isUpndFixPost?: boolean }>[] = [
</Badge>
);
}
return row.original.rowNo;
const totalRows = table.getRowCount();
const currentPage = table.getState().pagination.pageIndex;
const pageSize = table.getState().pagination.pageSize;
return totalRows - (currentPage * pageSize + row.index);
},
},
{
@@ -29,7 +29,7 @@ export const columns: ColumnDef<Post & { isUpndFixPost?: boolean }>[] = [
{
accessorKey: "rowNo",
header: "NO",
cell: ({ row }) => {
cell: ({ row, table }) => {
if (row.original.isUpndFixPost) {
return (
<Badge
@@ -40,7 +40,11 @@ export const columns: ColumnDef<Post & { isUpndFixPost?: boolean }>[] = [
</Badge>
);
}
return row.original.rowNo;
const totalRows = table.getRowCount();
const currentPage = table.getState().pagination.pageIndex;
const pageSize = table.getState().pagination.pageSize;
return totalRows - (currentPage * pageSize + row.index);
},
},
{
+1 -1
View File
@@ -78,7 +78,7 @@ function PostPage({ bbsId }: { bbsId: string }) {
isLoading,
refetch,
} = useQuery({
queryKey: [ENDPOINT.BOARD_SERVICE.POSTS, bbsInfo?.bbsTypeCd],
queryKey: [ENDPOINT.BOARD_SERVICE.POSTS, bbsInfo?.bbsTypeCd, pagination],
queryFn: () =>
PostApi.getPostList(parseInt(bbsId), {
...postParams,