我正在创建一个rallycardboard
,其中每列代表一个版本,并且这些卡是要安排到这些版本中的功能。组件的默认机制将所有可用版本呈现为板上的列。对于我们的特定应用程序,这是不合理的,因为我们的工作区中有数千个版本。
我能够覆盖addColumn
方法,只包含一个列,如果它是一个Release,该组中至少有一个Feature被分配给。下一步是使用户可以手动添加当前没有任何已分配工作的发布列。为此,我从第一步存储了所有排除的列,并创建了包含这些值的组合框。我希望这样当用户从组合框中选择一个Release时,该Release列被添加到棋盘中。
我能够重新配置我的addColumn
方法以允许手动覆盖(因为尝试与现有功能的发布匹配)。我通过调用board.getColumns()
验证了列已添加到板列中,并且现有列和添加列的配置看起来相同。但是,在调用board.renderColumns()
时收到错误消息,这似乎是尝试写入尚未存在的容器的结果(该列尚未创建)。
也许我以错误的方式解决这个问题。还有另一种方法可以更轻松地确定要在rallycardboard
组件上包含哪些列以及要排除哪些列?
答案 0 :(得分:0)
以下是一个示例,其中电路板列基于具有已调度功能的版本。要为当前没有安排功能的版本添加列,请从多重选择器中选择发布。
该应用程序位于this github repo。
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
_releasesWithFeatures: [],
_uniqueColumns: [],
_additionalColumns: [],
_updatedColumns: [],
_cardBoard: null,
launch: function() {
var that = this;
this._releasePicker = Ext.create('Rally.ui.picker.MultiObjectPicker', {
fieldLabel: 'Choose a Release',
modelType: 'Release'
});
this.add(this._releasePicker);
this.add({
xtype: 'rallybutton',
id: 'getReleases',
text: 'Add Selected Releases',
handler: function(){
that._getSelectedReleases();
}
})
Ext.create('Rally.data.WsapiDataStore', {
model: 'PortfolioItem/Feature',
fetch: ['FormattedID','Name','Release'],
pageSize: 100,
autoLoad: true,
filters: [
{
property: 'Release',
operator: '!=',
value: null
}
],
listeners: {
load: this._onScheduledFeaturesLoaded,
scope: this
}
});
},
_onScheduledFeaturesLoaded: function(store, data){
var that = this;
if (data.length !==0) {
_.each(data, function(feature){
console.log('feature ', feature.get('FormattedID'), 'scheduled for ', feature.get('Release')._refObjectName, feature.get('Release')._ref);
that._releasesWithFeatures.push(feature.get('Release'))
});
that._makeBoard();
}
else{
console.log('there are no features scheduled for a release')
}
},
_makeBoard: function(){
if (this._cardBoard) {
this._cardBoard.destroy();
}
var columns = [];
_.each(this._releasesWithFeatures, function(rel){
columns.push({value: rel._ref, columnHeaderConfig: {headerTpl: '{release}', headerData: {release: rel._refObjectName}}});
});
this._uniqueColumns = _.uniq(columns, 'value');
var cardBoard = {
xtype: 'rallycardboard',
itemId: 'piboard',
types: ['PortfolioItem/Feature'],
attribute: 'Release',
fieldToDisplay: 'Release',
columns: this._uniqueColumns
};
this._cardBoard = this.add(cardBoard);
},
_getSelectedReleases: function(){
var that = this;
var expandedColumns = [];
var selectedReleases = this._releasePicker._getRecordValue();
console.log(selectedReleases.length);
if (selectedReleases.length > 0) {
_.each(selectedReleases, function(rel) {
var releaseName = rel.get('Name');
var releaseRef = rel.get('_ref');
that._additionalColumns.push({value: releaseRef, columnHeaderConfig: {headerTpl: '{release}', headerData: {release: releaseName}}});
});
}
expandedColumns = _.union(that._uniqueColumns, that._additionalColumns);
this._updatedColumns = _.uniq(expandedColumns, 'value');
this._updateBoard();
},
_updateBoard: function(){
var that = this;
if (this._cardBoard) {
this._cardBoard.destroy();
}
var cardBoard = {
xtype: 'rallycardboard',
types: ['PortfolioItem/Feature'],
attribute: 'Release',
fieldToDisplay: 'Release',
columns: that._updatedColumns,
};
this._cardBoard = this.add(cardBoard);
}
});