title: How to change color of ag-grid cells for dynamically changing data
body: <p>I have a table that loads from dynamically changing data. It refreshes every 5 secs.
  I'm using ag-grid for it using this example: <a href="https://www.ag-grid.com/javascript-grid-sorting/index.php" rel="noreferrer">https://www.ag-grid.com/javascript-grid-sorting/index.php</a></p>
  
  <p>Is it possible to change color of the cells whose values have changes, like suppose a cell value is 100 and it becomes (less than this i.e. &lt;100) so make the cell red color, id it becomes greater, make it green color.
  I'm trying to do it using this example: <a href="https://www.ag-grid.com/javascript-grid-cell-styling/index.php" rel="noreferrer">https://www.ag-grid.com/javascript-grid-cell-styling/index.php</a></p>
  
  <p>But I can't understand how to do this.</p>
  
  <p>UPDATE: I'm doing it this way, but it's not changing the color:</p>
  
  <pre><code>var columnDefs = [
      {headerName: "Arr Px Slippage", field: "total_wt_arr_slp", width: 100, newValueHandler: compareValues},
      {headerName: "IVWAP Slippage", field: "total_wt_ivwap_slp", width: 100}
  
  
  ];
  
  function compareValues(params) {
      if (params.oldValue &gt; params.newValue){ 
      return {color: 'green', backgroundColor: 'black'};
      console.log(params.newValue);
  
      }
      if (params.oldValue &lt; params.newValue){ 
      return {color: 'red', backgroundColor: 'black'};
      }
  }
  </code></pre>