2013-07-15 466 views
0

我有一個集合,它有模型的集合。在提交給服務器之前,我必須獲取每個模型並設置更多屬性。修改骨幹集合

如何用骨幹做到這一點。

UPDATE:

這就是我試圖打印模式是否打印想嘗試與模型的set屬性,但它給我uncaught typeerror cannot call method 'each' of undefined

covertInvestmentJournal:function(){ 
      this.investmentTransactionsCollection.each(function(model){ 
        console.log(model); 
       }); 
     } 

回答

0

這是怎麼了我解決了我的問題:

for (var i = 0, l = investmentTransactionsCollection.length; i < l; i++) { 
       investmentTransactionsCollection.models[i].set({securityName:$('#security-name').val()}); 
       investmentTransactionsCollection.models[i].set({valueDate:DateUtils.formatAsYMD($('#value-date'))}); 
       investmentTransactionsCollection.models[i].set({adjustmentType:$('#adjustment-type').val()}); 
       investmentTransactionsCollection.models[i].set({assetClass:$('#assetclass').val()}); 
       investmentTransactionsCollection.models[i].set({currency:$('#currency').val()}); 
      }