0

我有一个从服务返回的对象studentInfo(它的 id 为 1)。

我克隆如下:

this.studentsInformation=dojo.clone(studentInfo);

现在我尝试更新克隆的对象 -studentInfo 我已经更新(比如 id 1)并存储在数据库中。如果我创建一个新的学生信息并尝试在数据库中更新,它必须使用 id 2。但对象的 id 为 1...

而且如果我打印this.studentsInformation,它不会显示原始对象..它只有修改过的对象..

所以我想要修改后的原始对象,也想在克隆后存储更新的信息。我怎样才能做到这一点?

4

1 回答 1

0

为什么不在克隆中存储对原始对象的引用?

this.studentsInformation=dojo.clone(studentInfo);
this.studentsInformation.myMama=studentInfo;

卢西安

于 2013-02-18T11:56:28.073 回答