Comments (14)
Yeah its great solution but I needed header info also. Is there any solution for the same?
from react-data-grid.
It should be well documented 👍
from react-data-grid.
Holy crap, I looked for this crap for almost 2 hours. This documentation is the worst i've seen.
from react-data-grid.
Damn! @maiis you just saved me tons of time!
from react-data-grid.
we'll track this under #41 as they will have a common solution.
Generally, we feel that a cell (formatter or editor) should not have access to the row data, but there are cases where you need access to some other props. We'd like to be explicit - but still allow people to provide the access if they need it. The solution above works fine, but we'd like to have a cleaner implementation though. Will update the docs too
from react-data-grid.
👍
from react-data-grid.
I used this getRowMetaData
trick myself. Thanks for posting here. Let me know if you add some other mechanism, but I like the current one.
from react-data-grid.
thanks @maiis, Just what i was looking for.
from react-data-grid.
I've been 2 hours searching for this!!!
from react-data-grid.
If I use the above column definition what does the static propTypes {} look like?
from react-data-grid.
Where
from react-data-grid.
Yes, such a pity, since the library is very cool...
from react-data-grid.
Having the same issue, couldn't replicate the provided solution using JSX
as a formatter because it throws a promise rejected exception.
Instead I'm using a function but I can't view the row data.
let columns = [
...
{
id: 'status',
name: 'Status',
getRowMetaData: (row) => row,
formatter: (_s, _o, rowObject) => _(renderStatus(rowObject)),
},
...
];
const renderStatus = (rowObject) => {
console.log(rowObject.getRowMetaData); // Returns the string "row => row"
return <StatusTest myVar={rowObject} />;
};
"gridjs": "^3.3.0",
"gridjs-react": "^3.2.2",
from react-data-grid.
In case anyone still searching for this, we can access row data with params.row for custom rendering which depends on other row data
const columns=[
{
headerName: "Duration",
key: "duration",
description: "run duration",
// getRowMetaData: (row) => row,
sortable: true,
type: "string",
valueGetter: (params) => {
console.log("row dat",params.row); // row data object
const endDate = params.row.completed_date
? moment.utc(params.row.completed_date)
: moment.utc(new Date());
const startDate = moment.utc(params.row.created_date);
var diff = moment.duration(endDate.diff(startDate));
const duration = [diff.hours(), diff.minutes(), diff.seconds()].join(":");
return duration + " Hrs";
},
valueFormatter: (params)=>{
console.log("row dat",params.row); // row data object
}
},
]
from react-data-grid.
Related Issues (20)
- Unresponsive Column Resizing in Firefox for Draggable Columns HOT 2
- Module '"react-data-grid"' has no exported member 'HeaderRendererProps'. Did you mean to use 'import HeaderRendererProps from "react-data-grid"' instead? HOT 1
- Column widths should recalculate when columns are added/removed from the columns array HOT 1
- TreeDataGridProps has wrong type for columns HOT 2
- Chrome mobile emulator: can't go to edit cell mode HOT 5
- Column auto size not working on Firefox HOT 3
- Deactivate editor mode if cell is not editable - old version
- 'SelectCellFormatter' cannot be used as a JSX component. HOT 4
- Hide header
- Space Navigation
- Make the cell tooltips keyboard accessible. HOT 2
- Editor getting activated on ANY key press HOT 1
- String field cannot be focused when trying to edit it
- Calculated Column is incorrectly not rendered when spanning multiple columns
- React Server Components Support
- UI Crash from NextJS HOT 9
- Header cell collapses when resizable set to true and promoted to staging environment HOT 15
- (Chrome) Scrollbar not working when parent/grandparent's scrollbar is visible
- Columns with auto width are not adjusted when rows are added after 1st render HOT 1
- Grouping & Sorting with different fields at same time
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-data-grid.