Rally 组合框在点击时不起作用
Rally combobox doesn't work on click
我想创建组合框,列出所有按名称过滤的 PortfolioItem/Feature。这是我的代码
Ext.define('Rally.Dashboard', {
extend: 'Rally.app.App',
launch: function () {
if (this.down('#features')) {
this.down('#features').destroy();
}
var features = Ext.create('Rally.ui.combobox.ComboBox', {
itemId: 'features',
allowNoEntry: false,
storeConfig: {
model: 'PortfolioItem/Feature',
fetch: ['FormattedID', 'Name', 'ObjectID', 'UserStories'],
autoSelect: true,
pageSize: 100,
autoLoad: true,
filters: [this._getFilter()]
},
fieldLabel: 'Select Feature',
listeners: {
ready: function (combobox) {
if (combobox.getRecord()) {
this._onFeatureSelected(combobox.getRecord());
}
},
select: function (combobox) {
if (combobox.getRecord()) {
this._onFeatureSelected(combobox.getRecord());
}
},
scope: this
}
});
this.add(features);
},
_onFeatureSelected: function (feature) {
console.log('feature', feature.get('Name'));
},//_onFeatureSelected
_getFilter: function ()
{
return {
property: 'Name',
operator: 'Contains',
value: 'Feature'
}
}
});
Rally.launchApp('Rally.Dashboard', {
name: 'example'
});
首次加载仪表板时,一切正常。但是当我点击组合框时,组合框将被清理,并且在日志中,它显示响应错误
"QueryResult": {"Errors": ["Could not parse: Could not find attribute \"_refObjectName\" 查询段中类型 PortfolioItems \"_refObjectName\""), "TotalResultCount": 0, "StartIndex": 0, "PageSize": 0, "Results": []}}
啊,组合框。不幸的是,由于整个产品的许多不同用途以及随着时间的推移进行了几次不兼容的 ExtJS 升级,该组件的生活并不顺利。
有一个非常好的 Artifact Search 组合框,我建议您改用它,因为我认为它可以为您处理一些奇怪的事情(包括提前搜索):
var features = Ext.create('Rally.ui.combobox.ArtifactSearchComboBox', {
itemId: 'features',
allowNoEntry: false,
storeConfig: {
models: ['PortfolioItem/Feature'],
fetch: ['FormattedID', 'Name', 'ObjectID', 'UserStories'],
pageSize: 100,
autoLoad: true // or false if you want to wait to load until click
},
fieldLabel: 'Select Feature',
listeners: {
ready: function (combobox) {
if (combobox.getRecord()) {
this._onFeatureSelected(combobox.getRecord());
}
},
select: function (combobox) {
if (combobox.getRecord()) {
this._onFeatureSelected(combobox.getRecord());
}
},
scope: this
}
});
我想创建组合框,列出所有按名称过滤的 PortfolioItem/Feature。这是我的代码
Ext.define('Rally.Dashboard', {
extend: 'Rally.app.App',
launch: function () {
if (this.down('#features')) {
this.down('#features').destroy();
}
var features = Ext.create('Rally.ui.combobox.ComboBox', {
itemId: 'features',
allowNoEntry: false,
storeConfig: {
model: 'PortfolioItem/Feature',
fetch: ['FormattedID', 'Name', 'ObjectID', 'UserStories'],
autoSelect: true,
pageSize: 100,
autoLoad: true,
filters: [this._getFilter()]
},
fieldLabel: 'Select Feature',
listeners: {
ready: function (combobox) {
if (combobox.getRecord()) {
this._onFeatureSelected(combobox.getRecord());
}
},
select: function (combobox) {
if (combobox.getRecord()) {
this._onFeatureSelected(combobox.getRecord());
}
},
scope: this
}
});
this.add(features);
},
_onFeatureSelected: function (feature) {
console.log('feature', feature.get('Name'));
},//_onFeatureSelected
_getFilter: function ()
{
return {
property: 'Name',
operator: 'Contains',
value: 'Feature'
}
}
});
Rally.launchApp('Rally.Dashboard', {
name: 'example'
});
首次加载仪表板时,一切正常。但是当我点击组合框时,组合框将被清理,并且在日志中,它显示响应错误
"QueryResult": {"Errors": ["Could not parse: Could not find attribute \"_refObjectName\" 查询段中类型 PortfolioItems \"_refObjectName\""), "TotalResultCount": 0, "StartIndex": 0, "PageSize": 0, "Results": []}}
啊,组合框。不幸的是,由于整个产品的许多不同用途以及随着时间的推移进行了几次不兼容的 ExtJS 升级,该组件的生活并不顺利。
有一个非常好的 Artifact Search 组合框,我建议您改用它,因为我认为它可以为您处理一些奇怪的事情(包括提前搜索):
var features = Ext.create('Rally.ui.combobox.ArtifactSearchComboBox', {
itemId: 'features',
allowNoEntry: false,
storeConfig: {
models: ['PortfolioItem/Feature'],
fetch: ['FormattedID', 'Name', 'ObjectID', 'UserStories'],
pageSize: 100,
autoLoad: true // or false if you want to wait to load until click
},
fieldLabel: 'Select Feature',
listeners: {
ready: function (combobox) {
if (combobox.getRecord()) {
this._onFeatureSelected(combobox.getRecord());
}
},
select: function (combobox) {
if (combobox.getRecord()) {
this._onFeatureSelected(combobox.getRecord());
}
},
scope: this
}
});