Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to edit cells in row and the alignment is taking a toss #3655

Closed
NiharikaSrinivasa opened this issue Nov 27, 2024 · 2 comments
Closed

Comments

@NiharikaSrinivasa
Copy link

version details :
"react": "^18.3.1",
"react-data-grid": "^7.0.0-beta.46",

code :
import React, { useState } from "react";
import DataGrid from "react-data-grid";
import "react-data-grid/lib/styles.css";
const App = () => {
const [rows, setRows] = useState([
{ id: 1, title: "Row 1", count: 20 },
{ id: 2, title: "Row 2", count: 40 },
{ id: 3, title: "Row 3", count: 60 },
]);

const columns = [
{ key: "id", name: "ID" }, // Not editable
{ key: "title", name: "Title", editable: true }, // Editable column
{ key: "count", name: "Count", editable: true }, // Editable column
];

const rowKeyGetter = (row) => row.id;

const handleRowsChange = (updatedRows, { indexes }) => {
console.log("Updated Rows:", updatedRows); // Debug: Log the new rows
const newRows = [...rows];
indexes.forEach((index) => {
newRows[index] = { ...newRows[index], ...updatedRows[index] };
});
setRows(newRows); // Update state
};

return (
<div style={{ height: 300 }}>


);
};

export default App;

Kindly help me with documentation to utilise the features of react-data-grid with react 18 version.

@amanmahajan7
Copy link
Contributor

Can you create a reproducible example?

@amanmahajan7
Copy link
Contributor

Closing due to inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants