手动将列添加到rallycardboard组件
我正在创建一个手动将列添加到rallycardboard组件,rally,appsdk2,Rally,Appsdk2,我正在创建一个rallycardboard,其中每一列代表一个发行版,这些卡片是要安排到这些发行版中的功能。组件的默认机制将所有可用版本呈现为板上的列。对于我们的特定应用程序,这是不合理的,因为我们的工作区中有数千个版本 我能够覆盖addColumn方法,仅在组中至少分配了一个功能的版本中包含一个列。下一步是让用户可以手动添加当前没有任何分配工作的发布列。为此,我存储了第一步中排除的所有列,并用这些值创建了一个组合框。我希望这样,当用户从组合框中选择发布时,该发布列将添加到板中 我能够重新配置我
rallycardboard
,其中每一列代表一个发行版,这些卡片是要安排到这些发行版中的功能。组件的默认机制将所有可用版本呈现为板上的列。对于我们的特定应用程序,这是不合理的,因为我们的工作区中有数千个版本
我能够覆盖addColumn
方法,仅在组中至少分配了一个功能的版本中包含一个列。下一步是让用户可以手动添加当前没有任何分配工作的发布列。为此,我存储了第一步中排除的所有列,并用这些值创建了一个组合框。我希望这样,当用户从组合框中选择发布时,该发布列将添加到板中
我能够重新配置我的addColumn
方法,以允许手动覆盖(与尝试与现有功能的版本相匹配)。我通过调用board.getColumns()
验证了该列已添加到boards列,并且现有列和添加列的配置看起来都相同。但是,调用board.renderColumns()时,我收到一条错误消息,这似乎是试图写入一个尚不存在的容器(该列尚未创建)的结果
也许我走错了方向。是否有其他方法可以更轻松地决定在rallycardboard
组件上包括哪些列以及排除哪些列
以下是一个示例,其中board列基于具有预定功能的发行版。要为当前没有计划功能的发布添加列,请从mulitpicker中选择releases 该应用程序在中提供
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);
}
});