javascript - Viewport datamodel - GetRow().data undefined
问题描述
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,
解决方案
基本上它是 ag-grid 中的一个错误/功能。
如果that.params.getRow(change.Id);
使用唯一的行标识符调用,则返回未呈现的对象并且尚未设置数据对象。
如果that.params.getRow(change.RowIndex);
被调用,则返回一个渲染对象 -> 设置数据对象。
推荐阅读
- scala - 无法运行火花壳!java.lang.NoSuchMethodError:org.apache.spark.repl.SparkILoop.mumly
- jquery - 为什么这个 Jquery slideToggle 不能在手机上工作?
- php - 正则表达式:获取带前缀的递归括号
- c++ - C++ 只有最后一次调用 SetConsoleCursorPosition() 正在工作
- react-native - React Native WebView 中的 Javascript console.log()
- python - re.sub、正则表达式和完全匹配
- c# - 如何根据屏幕上的触摸位置发射球?
- android - 如何以编程方式判断我的应用程序是否正在调试?
- python - 在 save() 期间 Peewee 检查“唯一约束失败”
- javascript - jquery函数在asp.net中使用Updatepanel不起作用