0
votes

i'm trying to implement updates for my viewport data model, with a methodology analogous to their description in their documentation:

https://www.ag-grid.com/javascript-grid-viewport/#

Unfortunately this approach is not working for me, since:

ViewportDatasource.prototype.onDataUpdated = function (elements) {
  var that = this;
  elements.forEach(function (change) {
    console.log(JSON.stringify(change))
    console.log('change.Id: ' + change.Id)
    var rowNode = that.params.getRow(change.Id);
    if (!rowNode || !rowNode.data) {.....}
}

always fails, as rowNode.data is always undefined (there is data in the model, as the basic grid itself is shown up fine). The rowNode itself is returned fine.

According to this, calls to rowNode.setData(..) rowNode.setDataValue('..', '...') are also failing.

Do you have any advise, how i can update single rows in viewport datamodel?

thanks in advance,

1

1 Answers

0
votes

Basically it's a bug/feature in ag-grid.

if that.params.getRow(change.Id); is called with the unique row identifier, a non rendered object is returned and the data object is not set (yet).

if that.params.getRow(change.RowIndex); is called, a rendered object is returned -> data object is set.