gpt4 book ai didi

javascript - Rally App SDK 2.0rc1 - 为什么我的组合框仅在第一次单击时忽略数据存储过滤器?

转载 作者:行者123 更新时间:2023-11-28 08:41:11 25 4
gpt4 key购买 nike

我有以下代码(草率,我知道......第一个javascript应用程序)。我正在尝试让组合框填充给定版本(如第一个组合框中选择的)下的功能列表。现在几乎一切都工作正常,除了每次我第一次单击功能组合框时,它都会加载所有功能并完全忽略过滤器。即使我首先更改发布框,功能框仍然仅在第一次单击时填充所有功能。随后,它会显示正确过滤的功能。

更奇怪的是,我尝试将功能存储中的总记录写入控制台,这样我就可以看到这种情况何时发生。首次创建功能组合框时,其中包含正确的记录数。但是,当我第一次单击功能组合框时,它会触发组合框的“加载”监听器,并拉入所有功能,完全忽略过滤器。

我很困惑,我已经尝试了很多方法来调试它,但此时没有其他选择。有谁知道为什么它会首先加载正确的数据,然后重新加载并在第一次单击时忽略过滤器?

Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',

launch: function() {

var relComboBox = Ext.create("Rally.ui.combobox.ReleaseComboBox", {
fieldLabel: 'Choose a Release',
width: 300,
listeners: {
ready: function(combobox) {
this._releaseRef = combobox.getRecord().get("_ref");
this._loadFeatureInfo();
},
select: function(combobox) {
this._releaseRef = combobox.getRecord().get("_ref");
this._loadFeatureInfo();
},
scope: this
}
});

this.add(relComboBox);
},
_loadFeatureInfo: function() {
var featureStore = Ext.create("Rally.data.WsapiDataStore", {
model: "portfolioitem/Feature",
fetch: ["Name", "_ref"],
autoLoad: true,
filters: [
{
property: "Release",
operator: "=",
value: this._releaseRef
}
],
listeners: {
load: function(store) {
this._updateFeatureBox(store);
},
scope: this
}
});
},
_createFeatureBox: function(featureStore) {
this._featureComboBox = Ext.create("Rally.ui.combobox.ComboBox", {
fieldLabel: 'Choose a Feature to move',
store: featureStore,
listeners: {
select: function (combobox) {
this._featureRef = combobox.getRecord().get("_ref");
//calls method to get and display children of this feature in a grid
},
scope: this
}
});
this.add(this._featureComboBox);
},
_updateFeatureBox: function(featureStore) {
if (this._featureComboBox === undefined) {
this._createFeatureBox(featureStore);
} else {
this._featureComboBox.clearValue();
this._featureComboBox.bindStore(featureStore);
//calls method to get and display children of this feature in a grid
}
}

最佳答案

这可能是由于 featureStore 加载两次引起的问题:一次是在您创建它时加载,并且组合框还会告诉它在用户打开组合框选择功能后再次加载。

我在故事上的组合框上遇到了非常类似的问题,我敢打赌 Matt Greer 的 donut 。的回答:

Strange Load behavior with Rally.ui.combobox.ComboBox

我的问题,也是你问题的答案...

关于javascript - Rally App SDK 2.0rc1 - 为什么我的组合框仅在第一次单击时忽略数据存储过滤器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20478310/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com