问题
I am trying to set parent for features which I copied for particular MMF, but parent is getting set for only last feature.
Below line of code to set the parent Record is new feature object _newParent is the MMF object, where I am doing wrong
record.set("Parent", _newParent.get("_ref")),
Need help please.Any suggestions?
Whole is method is this
_genericInnerCopy: function(_childObj) {
that = this;
model = that.model;
var record = Ext.create(model, {
Name: _childObj.get('Name'),
//Parent: _newParent.get("_ref");,
});
record.save({
callback: function(result, operation) {
if(operation.wasSuccessful()) {
console.log("Done");
//that._copyChild();
} else {
console.log("error");
}
}
})
that._all_pis.push(record);
console.log("all pis values", that._all_pis);
var store = Ext.create('Rally.data.custom.Store', {
data: that._all_pis,
listeners: {
load: that._updateAll,
scope: that
},
});
//console.log("record values", that._all_pis);
},
_updateAll: function(store,data) {
console.log("store values", store);
console.log("data values", data);
Rally.data.BulkRecordUpdater.updateRecords({
records: data,
propertiesToUpdate: {
Parent: _newParent.get("_ref")
},
success: function(readOnlyRecords){
//all updates finished, except for given read only records
},
scope: that
});
//that._createNewItems(that._all_pis);
},
回答1:
The problem in your original question was that your code wasnt spitting out the errors in the callback. To see the errors you can console.log(operation.getError()) or console.log(operation) and inspect the output.
来源:https://stackoverflow.com/questions/26097883/not-able-to-update-parent-for-all-portfolioitem-feature-which-i-copied-for-parti