-
-
Notifications
You must be signed in to change notification settings - Fork 12
Closed
Labels
wontfixThis will not be worked onThis will not be worked on
Description
Describe the bug
It doesn't work when adding a component with the _ function.
To Reproduce
Steps to reproduce the behavior:
- Add the components with their columns and values.
- View the result in the browser.
Expected behavior
I was expecting the button type component to be added for each row.
Screenshots
Desktop (please complete the following information):
- OS: Debian (In a Docker container)
- Browser: Google chrome
Additional context
I have read different sources and it still seems like everything is correct and yet it doesn't work.
This is my code:
import { _, Grid } from "gridjs-react";
export default function TableSuppliers() {
return (
<Grid
fixedHeader={true}
search={true}
sort={true}
autoWidth={true}
pagination={{
enabled: true,
limit: 10,
}}
language={{
search: {
placeholder: "🔍 Buscar...",
},
}}
columns={[
"Nombre",
"Razón Social",
"Télefono",
"Correo",
"Dirección",
"Actions",
]}
server={{
url: "/suppliers.json",
then: (data) =>
data.map((card) => [
card.name,
card.nit,
card.phone,
card.email,
card.address,
_(
<button
key={card.id}
className={"py-2 px-4 border rounded-md text-white bg-blue-600"}
onClick={() => console.log("Clicked")}
>
{"Edit"}
</button>
),
]),
}}
/>
);
}
Data obtained from suppliers.json:
[
{
"id": 1,
"name": "Proveedor 1",
"nit": "0123456789",
"phone": "+57 310 000 0000",
"email": "proveedor1@example.com",
"address": "123 Main St, Suba, Bogotá",
"deleted_at": null
},
{
"id": 2,
"name": "Proveedor 2",
"nit": "0123456789",
"phone": "+57 310 000 0000",
"email": "proveedor2@example.com",
"address": "123 Main St, Sucre, Girardot",
"deleted_at": null
},
{
"id": 3,
"name": "Proveedor 3",
"nit": "0123456789",
"phone": "+57 310 000 0000",
"email": "proveedor3@example.com",
"address": "123 Main St, Anytown, Ibagué",
"deleted_at": "2025-01-01 08:00:00"
}
]
Metadata
Metadata
Assignees
Labels
wontfixThis will not be worked onThis will not be worked on