2014-03-03 48 views
1

我正在嘗試爲拉力賽創建一個新應用程序,而我對拉力賽SDK和JavaScript都是新手。我找到了關於構建第一個Rally應用程序的教程,我試着從那裏開始。但是,在接下來的示例中出現錯誤。拉力賽示例應用程序錯誤

Uncaught TypeError: Cannot call method 'refresh' of undefined 

起初,我以爲我是做錯了,但最終我複製&在粘貼整個示例應用程序,才發現它的發生示例項目了。

任何指向我在正確的方向成功調試這將不勝感激!

,我使用(從示例)整個App.js是這樣的:

Ext.define('CustomApp', { 
    extend: 'Rally.app.App', 
    componentCls: 'app', 
    items: { html: '<a href="https://help.rallydev.com/apps/2.0rc2/doc/">App SDK 2.0rc2 Docs</a>' }, 
    launch: function() { 
    this.iterationCombobox = this.add({ 
     xtype: 'rallyiterationcombobox', 
     listeners: { 
     change: this._onIterationComboboxChanged, 
     ready: this._onIterationComboboxLoad, 
     scope: this 
     } 
    }); 
    }, 

    _onIterationComboboxLoad: function() { 
    var addNewConfig = { 
     xtype: 'rallyaddnew', 
     recordTypes: ['User Story', 'Defect'], 
     ignoredRequiredFields: ['Name', 'ScheduleState', 'Project'], 
     showAddWithDetails: false, 
     listeners: { 
     beforecreate: this._onBeforeCreate, 
     scope: this 
     } 
    }; 

    this.addNew = this.add(addNewConfig); 

    var cardBoardConfig = { 
     xtype: 'rallycardboard', 
     types: ['Defect', 'User Story'], 
     attribute: 'ScheduleState', 
     storeConfig: { 
     filters: [this.iterationCombobox.getQueryFromSelected()] 
     } 
    }; 
    this.cardBoard = this.add(cardBoardConfig); 
    }, 

    _onBeforeCreate: function (addNewComponent, record) { 
    record.set('Iteration', this.iterationCombobox.getValue()); 
    }, 

    _onIterationComboboxChanged: function() { 
    var config = { 
     storeConfig: { 
     filters: [this.iterationCombobox.getQueryFromSelected()] 
     } 
    }; 

    this.cardBoard.refresh(config); 
    } 
}); 
+0

示例應用程序從哪裏來的?它是在開發者平臺上還是包含在Rally App Builder中?我們應該修正樣本。 –

+0

@KyleMorse,這個樣本來自開發者門戶。 https://help.rallydev.com/apps/2.0rc2/doc/#!/guide/first_app – fussmonkey

+0

謝謝,我會確保清理乾淨。當教程被破壞時,這是一個無賴! –

回答

1

試試這個代碼,而不是。來源可在this git hub repo

Ext.define('CustomApp', { 
    extend: 'Rally.app.TimeboxScopedApp', 
    componentCls: 'app', 
    scopeType: 'iteration', 
    onScopeChange: function(scope) { 
     this._iteration = scope.record.get('_ref'); 
     if (!this.down('#addNew')) { 
     var addNewConfig = { 
      xtype: 'rallyaddnew', 
      itemId: 'addNew', 
      recordTypes: ['User Story', 'Defect'], 
      ignoredRequiredFields: ['Name', 'ScheduleState', 'Project'], 
      showAddWithDetails: false, 
      listeners: { 
       beforecreate: this._onBeforeCreate, 
       scope: this 
      } 
     }; 
    } 


     this.addNew = this.add(addNewConfig); 
     if(!this.board) { 
      this.board = this.add({ 
       xtype: 'rallycardboard', 
       storeConfig: { 
        filters: [scope.getQueryFilter()] 
       } 
      }); 
     } else { 
      this.board.refresh({ 
       storeConfig: { 
        filters: [scope.getQueryFilter()] 
       } 
      }); 
     } 
     this.iteration = scope.getRecord(); 
    }, 

    _onBeforeCreate: function(addNewComponent, record) { 
    record.set('Iteration', this._iteration); 
} 
}); 
+0

是的,工作,謝謝! – fussmonkey