score:1
for now, it seems that the only possible way and place to implement this is to use the ongridready
event, and there it is possible to set values for calculated rows (via rownode.setdatavalue()
). the grid has all data (+ aggregated data) at this stage. this link is useful to understand how to collect all data.
the better way is to define getrownodeid
callback
getrownodeid: row => {
// custom rownodeid resolver
},
and get values by data column and rowid (jan, feb, etc.).
here is a simple implementation:
ongridready: ({ api }) => {
const income = api.getrownode('row-group-0');
const in1row = api.getrownode('incomein 1');
const in2row = api.getrownode('incomein 2');
const liabilities = api.getrownode('liabilities');
api.foreachnode(rownode => console.log(rownode.id));
for (const col of ["jan", "feb"]) {
const netincome = api.getvalue(col, in1row) + api.getvalue(col, in2row) - api.getvalue(col, liabilities);
const netincometotal = api.getvalue(col, income) - api.getvalue(col, liabilities);
const netincomerow = api.getrownode('net income');
netincomerow.setdatavalue(col, netincome);
const netincometotalrow = api.getrownode('net income total');
netincometotalrow.setdatavalue(col, netincometotal);
}
}
reference to plunker here.
score:1
have you looked at calculated columns in adaptable which we use in conjunction with ag grid.
it gives you exactly what you want: https://docs.adaptabletools.com/guide/handbook-calculated-column
Source: stackoverflow.com
Related Query
- Calculated row: How to calculate cell value of the particular column based on the values from other rows in the same column using AG Grid?
- Antd: How to get the entire row value in a specific cell click?
- How to hide a column on REACT Material table in all rows and show it on Edit for the Particular Row I am editing and Add Operations on new row adding?
- React-table: How to sort table data based on the changed cell value (override the default sorting with cell props.value)?
- how can i get the more than one data row value based on selected checkbox and store in useState (react-table-boostrap2)
- How can I conditionally disable a control in Storybook based on the value of another argument?
- How to make the row editable when clicking on an "Edit" button on a cell with react-table
- How can I make the edit-mode field type of one material-table column dependent upon the value of another column, without affecting other rows?
- How to calculate the speed of an animation in seconds based on current pageYOffset and previousPageYOffset?
- how to render components based on the value of props?
- How can I show edit button in column cell while hovering over table row in Material UI Table?
- How to set excelsheet row height to auto so that the content can autofit in the cell using exceljs
- ReactJS 7 - How to conditionally change the background color of table cell only (not the row) based on its value?
- How to set initial state value in Gatsby based on the result from static query?
- How can I render API data into separate tables based on the value in React?
- How do I reset the value of the textfield based on what chosen on the radio button?
- How can I make a Tailwind column full-width when it is the only column in a row
- How do I conditionally render an icon based on the value of a prop?
- React table - how to merge tables for specific column and cell value
- How to change a className of a particular element based off it's child input value and input dataset comparison?
- In React, how can I calculate the width of a parent based on it's child components?
- How can I set the default state of a checkbox based on value in firestore in react table
- In Redux Forms, how do I validate one field based on the value of another?
- How to get the row index of a clicked cell in react-table?
- how to reduce the height of cell or row in react?
- How can I import a file using React.js, ES6 and Webpack based on the value of a prop?
- How to filter value based on the nested array value?
- How to add rowClassName to a particular row in antd table on onClick of the row and not after onMouseLeave
- How to show the specified table row data based on the filter option in react js
- How to assign a value to particular cell in table layout in react js?
More Query from same tag
- Maximum update depth exceeded with react context api
- How to deploy React Next.JS on iis?
- Unexpected user of comma operator no-sequences
- How to fix a css navigation flashing issue
- ReactJS components in same bundle across different pages
- ReactDOM.findDOMNode() using React.Children child
- React Router with React 16.6 Suspense "Invalid prop `component` of type `object` supplied to `Route`, expected `function`."
- React how to test function called in FileReader onload function
- props.history.push('/') does not go to top of page (need functional component)
- React routing not working in react boilerplate
- How to use Webpack for Just Transpiling not for Bundling
- How to update a state of a specific index in array
- Creating a JSX list in React with an object
- how to get multiple inputs type date values to console with checking if empty
- Redux - How to calculate the cost of a list of carts from a normalised state
- React Dynamic Child Component Numbering
- ReactJS map function error
- How can I make the useState append the data and not overrides it
- React component not working
- Accessing child page directly without parent props
- Why useEffect doesn't trigger on document change?
- React Redux - How do I build a form with material-ui that I can add inputs to?
- Why am I receiving undefined values in both input's of my form (User selected Image file + Image title (not filename) ) when making request to my API?
- React Redux setup returns a function rather than the value
- cannot get default value of datetime picker to work properly
- FastField not working as expected in Formik
- React component unit test with enzyme fails when rendering Image tag with svg
- Passing Data Between React Classes doesn't work
- How to render conditionally depending on which button is clicked?
- Sum of all values from a dynamic key in object array