更新 ArrayController 的 content 属性中的元素的最佳方法是什么,以便更新任何关联的视图。
目前,我使用以下代码,它更新内容但不更新视图
updateContent: function(device) {
for (var index = 0; index < this.content.length; index++) {
if (this.content[index]._id === device._id) {
this.content.splice(index, 1, device);
break;
}
}
}
这样做的最佳方法是什么?
在这种特殊情况下,我使用 soket.io 接收来自服务器的调用,因为设备状态会在相应地更新视图时发生变化。