refactor: 테이블 넘버링 코드 수정

This commit is contained in:
2025-06-17 11:10:15 +09:00
parent 318bae3a1e
commit 2c9793c7be
13 changed files with 79 additions and 12 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",
@@ -8,7 +8,12 @@ export const columns = [
columnHelper.display({
id: "no",
header: "NO",
cell: ({ row }) => row.index + 1,
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);
},
}),
columnHelper.accessor("contsTtl", {
id: "contsTtl",
@@ -11,7 +11,12 @@ export const createColumns = (
{
id: "no",
header: "NO",
cell: (info) => info.row.index + 1,
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: "atflId",
@@ -31,7 +31,12 @@ export const columns: ColumnDef<Image>[] = [
{
accessorKey: "imgSn",
header: "NO",
cell: ({ row }) => row.index + 1,
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: "imgTypeCd",
@@ -6,7 +6,12 @@ export const columns: ColumnDef<BoardPopup>[] = [
{
id: "no",
header: "NO",
cell: ({ row }) => row.index + 1,
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: "bbsNm",
@@ -7,7 +7,12 @@ export const columns: ColumnDef<Contents>[] = [
{
id: "no",
header: "NO",
cell: ({ row }) => row.index + 1,
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);
},
},
{
id: "contsTtl",
@@ -7,7 +7,12 @@ export const columns: ColumnDef<Authorizations>[] = [
{
id: "no",
header: "NO",
cell: ({ row }) => row.index + 1,
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: "authorizationName",
@@ -32,6 +32,12 @@ export const columns: ColumnDef<RecentPost>[] = [
{
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);
},
meta: {
width: 80,
},
@@ -1,14 +1,19 @@
import dayjs from "dayjs";
import { useState } from "react";
import type { Role } from "@/entities/role";
import type { ColumnDef } from "@tanstack/react-table";
import { MappingRoleDialog } from "../ui/mapping-role-dialog";
import type { Role } from "./role-interface";
export const columns: ColumnDef<Role>[] = [
{
id: "no",
header: "NO",
cell: ({ row }) => row.index + 1,
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: "roleId",
@@ -6,7 +6,12 @@ export const columns: ColumnDef<Site>[] = [
{
id: "no",
header: "NO",
cell: ({ row }) => row.index + 1,
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: "siteId",
@@ -6,7 +6,12 @@ export const columns: ColumnDef<Template>[] = [
{
id: "no",
header: "NO",
cell: ({ row }) => row.index + 1,
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: "tmpltNm",
@@ -6,7 +6,12 @@ export const columns: ColumnDef<Terms>[] = [
{
id: "no",
header: "NO",
cell: ({ row }) => row.index + 1,
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: "trmsTtl",
@@ -6,7 +6,12 @@ export const columns: ColumnDef<UserListResponse>[] = [
{
id: "no",
header: "No",
cell: ({ row }) => row.index + 1,
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: "userId",