Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

112
Vistas
Adding checkboxes column for each row in table

Hello how can I add a new column with checkboxes for each row on the left side of my id column.

export default function Display() {
  const { menus } = JsonData;

  const data = useMemo(
    () => [
      {
        Header: "Id",
        // accessor: "id"
        accessor: (row) => row.id
      },
      {
        Header: "Title",
        accessor: (row) => ({ title: row.title, id: row.id }),        
        Cell: ({ value }) => (
          <Link to={{ pathname: `/menu/${value.id}` }}>{value.title}</Link>
        )
      }
    ],
    []
  );

   return (
    <Table
      data={menus}
      columns={data}
      withCellBorder
      withRowBorder
      withSorting
      withPagination
    />
  );
}

Here is my codeSandbox

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Just add a new entry into the array:

export default function Display() {
  const { menus } = JsonData;

  const data = useMemo(
    () => [
      {
        Header: "Ceckbox",
        // accessor: "id"
        accessor: (row) => row.id,
        Cell: ({ value }) => (
          <input type='checkbox' />
        )
      },
      {
        Header: "Id",
        // accessor: "id"
        accessor: (row) => row.id
      },
      {
        Header: "Title",
        accessor: (row) => ({ title: row.title, id: row.id }),        
        Cell: ({ value }) => (
          <Link to={{ pathname: `/menu/${value.id}` }}>{value.title}</Link>
        )
      }
    ],
    []
  );

   return (
    <Table
      data={menus}
      columns={data}
      withCellBorder
      withRowBorder
      withSorting
      withPagination
    />
  );
}
about 4 years ago · Santiago Trujillo Denunciar

0

You can add new column to your data :

const data = useMemo(
    () => [
      {
        id: "check",
        accessor: (row) => row.title,
        Cell: ({ value }) => <input type="checkbox" value={value} />
      },
      {
        Header: "Id",
        // accessor: "id"
        accessor: (row) => row.id
      },
      {
        Header: "Title",
        // accessor: "title"
        accessor: (row) => ({ title: row.title, id: row.id }),
        // accessor: (row) => (
        //   <Link to={{ pathname: `/menu/${row.id}` }}>{row.title}</Link>
        // )
        // Link the content of my cell. NOT WORKING
        //Cell: ({ row }) => (
        //<Link to={{ pathname: `/menu/${row.id}` }}>{row.title}</Link>
        //)
        Cell: ({ value }) => (
          <Link to={{ pathname: `/menu/${value.id}` }}>{value.title}</Link>
        )
      }
    ],
    []
  );

Edit filters (forked)

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda