title: How to Get Updated Rows in Ag-grid
body: <p>Upon clicking "Insert New Row" button, below method is triggered and an empty new row is appended to current last row. </p>
  
  <pre><code>insertNewRow(){
  
      var newItem = this.createNewRowData();
      var res = this.gridOptions.api.updateRowData({add: [newItem]});
  
    }
  
  createNewRowData(){
      var newData = [];
      //blah blah
      return newData;
    }
  </code></pre>
  
  <p>After I enriched the data on screen, how can I let the grid to pick up new rows (and probably all rows that have been changed since last DB retrieval)? </p>
  
  <p>Note that I am able to click "Insert New Row" multiple times to create multiple rows before I hit Save button. </p>
  
  <pre><code>saveChanges(){
      var data = "HOW TO GET NEW ROWS AND UPDATED ROWS, AND STORE HERE??";
      this.myAppService.saveData(data).subscribe(
      //blah blah
      );
      console.log("Saved successfully to database");
    }
  </code></pre>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>Tried with storing previous records into a variable ("tableData"):</p>
  
  <pre><code>tableData: string[] = [];
  currentData: string[] = [];
  
  retrieveTableData (){
      //blah blah
      tableData loaded with an array of json
  }
  
  saveChanges(){
      this.gridOptions.api.forEachNode((rowNode) =&gt; {
        this.currentData.push(rowNode.data);
      });
      console.log(this.currentData);
      this.currentData.forEach(item =&gt; {
        console.log(item);
        if (!this.tableData.includes(item)){
        console.log("Updated Row: " + item);
        }
      });
    }
  </code></pre>
  
  <p>I guess there are some problems with data types etc. </p>
  
  <p>Sample of console logging "tableData" and "currentData":</p>
  
  <pre><code>[object Object],[object Object],[object Object]
  </code></pre>
  
  <p>if I print out each item under either variable:</p>
  
  <pre><code>{FUND_CODE: "TEST1", PORT_CODE: "TEST1"}
  </code></pre>