1
Copied PortfolioItem/MMF及其功能,但如果有5個功能它顯示6 下面是我的應用程序的一些代碼。我嘗試了大部分的東西,但能夠弄清楚什麼是錯的。對此有任何建議。複製PortfolioItem/MMF及其功能,但如果有5個功能顯示6
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
_newObj : {},
_newParent : null,
childrens: [],
childs: [],
_all_pis: [],
_toBeCreatedChild : [],
_type : null,
launch: function() {
Ext.create('Rally.ui.dialog.ChooserDialog', {
width: 450,
autoScroll: true,
height: 525,
title: 'Select to Copy',
pageSize: 100,
closable: false,
selectionButtonText: 'Copy',
artifactTypes: ['PortfolioItem/Feature','PortfolioItem/MMF','PortfolioItem/Epic', 'PortfolioItem/Program'],
autoShow: true,
storeConfig:{
fetch: ['Name','PortfolioItemTypeName']
},
listeners: {
artifactChosen: function(selectedRecord) {
childrens = [];
this._type = selectedRecord.get('PortfolioItemTypeName');
this._newObj = selectedRecord;
this.onqModelRetrieved();
var self = this;
Ext.create('Rally.data.wsapi.Store', {
model: 'PortfolioItem/' + selectedRecord.get('PortfolioItemTypeName'),
fetch: ['Name', 'FormattedID', 'Children'],
pageSize: 1,
autoLoad: true,
listeners: {
load: function(store, records) {
final_features = [];
Ext.Array.each(records, function(child){
var item = selectedRecord;
childrens = item.getCollection('Children');
childrens.load({
fetch: ['FormattedID'],
callback: function(records, operation, success){
Ext.Array.each(records, function(portfolioitem){
self._childObj = {};
self._childObj = portfolioitem;
self._innerModelRetrieved();
}, self);
},
scope: this
});
}, self);
}
}
});
},
scope: this
},
});
},
// Inner Copy functions
_innerModelRetrieved: function() {
var that = this;
(function(){
var child = that._childObj;
that._type = 'PortfolioItem/' + that._childObj.get('PortfolioItemTypeName');
Rally.data.ModelFactory.getModel({
type: that._type,
success: function(model){
that.onInnerModelRetrieved(model, child);
},
scope: that
});
})();
},
onInnerModelRetrieved: function(model, _childObj) {
that = this;
this.model = model;
that._genericInnerCopy(_childObj);
},
_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) {
Rally.data.BulkRecordUpdater.updateRecords({
records: data,
propertiesToUpdate: {
Parent: _newParent.get("_ref")
},
success: function(readOnlyRecords){
that._createCustomStore(data);
//all updates finished, except for given read only records
},
scope: that
});
},
在圖像中你可以看到物體,那些是特徵物體。
請問您將從服務器獲得的JSON發回來嗎? – pherris 2014-10-02 15:00:28
@pherris - 用代碼和JSON代碼更新問題 – Sontya 2014-10-02 17:40:01