2014-09-19 60 views
1

需要幫助這個
從下面的代碼我想通過一些參數來調用函數,它是genericInnerCopy 但我不能傳遞參數,bydefault模型參數傳遞傳遞參數調用方法

   var that = child; 
       that._type = 'PortfolioItem/' + that.get('PortfolioItemTypeName'); 
       Rally.data.ModelFactory.getModel({ 
        type: that._type, 
        success: this.genericInnerCopy, 
        scope: this 
       }); 

在下面的方法,我想使用的子對象從上述方法

   genericInnerCopy: function(model) { 
       this.model = model; 
       var record = Ext.create(this.model, { 
        Name: child.get('Name'), 
       }); 
       record.save; 
       }, 

對此有何建議。提前致謝。

回答

0

假設this點到應用,

var that = this; 

您可以創建一個對象,它是提供該應用的任何:

that._child = child; 

,你不必傳遞給它的引用作爲參數。

+0

謝謝尼克。但是孩子的對象每次都必須改變。我正在循環使用特性,MMF。 – Sontya 2014-09-22 04:35:05