对不起,如果之前已经讨论过这个问题--但是我在Rally.ui.combobox.ComboBox中遇到了一些奇怪的负载行为。
这个应用程序所做的(到目前为止)就是这样:
在单击UserStory组合框时,我看到了一些奇怪的行为。它最初只显示了少数几个故事(正确地说,那些在选定的迭代中)。
然而,一两分钟后,它重新绘制自己,然后显示我的项目中的所有故事。
JS控制台显示了其中几个错误:
Uncaught TypeError: Cannot call method 'getCount' of nullUncaught TypeError: Cannot read property 'loading' of null我怀疑我做错了什么时间,什么时候的故事组合框准备好。因此,我添加了一个onReady处理程序,但它似乎帮不了什么忙。
有关这种行为的视频如下:
我的代码显示在这里:
<!DOCTYPE html>
<html>
<head>
<title>CustomApp</title>
<!-- (c) 2013 Rally Software Development Corp. All Rights Reserved. -->
<!-- Build Date: Mon Jul 15 2013 14:23:12 GMT-0600 (Mountain Daylight Time) -->
<script type="text/javascript" src="https://rally1.rallydev.com/apps/2.0rc1/sdk.js"></script>
<script type="text/javascript">
Rally.onReady(function() {
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
// Stores the Selected Iteration
selectedIteration: null,
// Data Store for Stories
storyStore: null,
// Stores the Selected Story
selectedStory: null,
// Reference to lumenize
lumenize: null,
items: [
{
xtype: 'container',
itemId: 'iterationDropdownContainer',
columnWidth: 1
},
{
xtype: 'container',
itemId: 'storyDropdownContainer',
columnWidth: 1
},
{
xtype: 'container',
itemId: 'testResultSummaryContainer',
columnWidth: 1
}
],
launch: function() {
// Add the iteration dropdown selector
this.down("#iterationDropdownContainer").add( {
xtype: 'rallyiterationcombobox',
itemId : 'iterationSelector',
listeners: {
select: this._onIterationSelect,
scope: this
}
});
// Lumenize
this.lumenize = window.parent.Rally.data.lookback.Lumenize;
},
// Callback when an iteration is selected.
_onIterationSelect : function() {
// Store and save the Selected Iteration
var iterationRecord = this.down('#iterationSelector').getRecord();
this.selectedIteration = iterationRecord.data;
console.log(iterationRecord);
// Query to get all Stories in Iteration
this.storyStore = Ext.create('Rally.data.WsapiDataStore', {
model: "User Story",
autoLoad: true,
fetch: ["ObjectID","Name","Iteration","TestCases"],
filters: [
{
property: 'Iteration.Name',
value: this.selectedIteration.Name
}
],
listeners: {
scope : this,
load : this._storiesLoaded
}
});
},
// Callback when Story Store is loaded
_storiesLoaded : function(store, data, success) {
console.log("_storiesLoaded");
console.log(data);
if(this.down("#storySelector")) {
this.down("#storySelector").destroy();
}
// Add a story object dropdown selector
this.down("#storyDropdownContainer").add( {
xtype: 'rallycombobox',
store: this.storyStore,
autoLoad: false,
disabled: true,
itemId : 'storySelector',
listeners: {
ready: this._storySelectorReady,
select: this._onStorySelected,
scope: this
}
});
},
_storySelectorReady: function(storyCombobox) {
storyCombobox.disabled = false;
},
// Callback when a Story has been selected
_onStorySelected : function() {
// Store and save the Selected Iteration
var storyRecord = this.down('#storySelector').getRecord();
this.selectedStory = storyRecord.data;
console.log(storyRecord);
},
_showTable : function() {
console.log("_showTable");
}
});
Rally.launchApp('CustomApp', {
name: 'CustomApp'
});
});
</script>
<link rel="stylesheet" type="text/css" href="src/style/app.css">
</head>
<body></body>
</html>发布于 2013-09-06 00:44:01
storyStore正在加载两次,一次是在创建它时,而combobox还告诉它,一旦用户打开combobox来选择一个故事,就再次加载它。因此,您的商店负载侦听器将被调用两次,实际上正在创建两个层的组合框。在Ext的深处,它不喜欢这个。
最简单的解决方法是将single: true添加到商店的侦听器中:
listeners: {
scope : this,
load : this._storiesLoaded,
single: true
}但是,更好的方法可能是将商店设置为创建故事组合框的一部分:
_onIterationSelect : function() {
// Store and save the Selected Iteration
var iterationRecord = this.down('#iterationSelector').getRecord();
this.selectedIteration = iterationRecord.data;
console.log(iterationRecord);
this.down("#storyDropdownContainer").add( {
xtype: 'rallycombobox',
itemId : 'storySelector',
storeConfig: {
model: 'User Story',
autoLoad: true,
filters: [{
property: 'Iteration.Name',
value: this.selectedIteration.Name
}]
},
listeners: {
ready: this._storySelectorReady,
select: this._onStorySelected,
scope: this
}
});
},https://stackoverflow.com/questions/17663475
复制相似问题