0
votes

I just used AG-grid in our React project and I just changed the data structure of rowData like below:

const data =  [
    { 
        tail: '1M', 
        live_1Y1Y: { 
            value: 3.0, 
            target: 'live_1Y1Y_1M' 
         }
    }
];

and my colDefs is:

[
    { 
        headerName: 'TAIL', 
        field: 'tail', 
        width: 100 
    },
    { 
        headerName: '1Y1Y', 
        field: 'live_1Y1Y',
        valueGetter: function (params) { 
            return params.data[params.colDef.field]['value']; 
        }
    }
]

When the value: 3.0 is changed, I can't see any update on the page. I also set the

deltaRowDataMode={true}
getRowNodeId={data => data.id}

but it still does not work.

1

1 Answers

0
votes

Here's a helpful link in the documentation about change detection:

https://www.ag-grid.com/javascript-grid-change-detection/.

Here's a helpful link in the documentation about view refresh:

https://www.ag-grid.com/javascript-grid-refresh/.

A couple of other things to consider:

  1. If you have valueCache set to true, it caches the value of your valueGetter
  2. Did you intend to declare data with const? If it's going to change later, it may be better to use let instead of const.