我正在尝试为Rally创建一个新的应用程序,而且我是Rally 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 :(得分: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);
}
});