使用 LookBack 中的 UserID 检索 UserName
Retrieving UserName using UserID from LookBack
我正在使用 LookBack 获取历史修订信息。
我得到 _User 值,它是一个用户 ID。
我将如何去检索相应的用户名?
我玩过 ModelFactories 但没有成功。
//use lookback api to retrieve user story info
_createRevisionInfo: function(record, item)
{
var userStoryID = item.get('FormattedID');
var userStoryName = item.get('Name');
var snapShotFilters = this._getSnapShotFilters(userStoryName, userStoryID);
//create store
this.snapshotStore = Ext.create('Rally.data.lookback.SnapshotStore',
{
fetch: ['ScheduleState', '_ValidFrom', 'PlanEstimate', '_User'],
autoLoad: true,
filters: snapShotFilters,
hydrate: ['ScheduleState'],
sortOnFilter: true,
sortonload: true,
.
.
});
},
_onSnapShotStoreLoad: function()
{
if(!this.down('#my-grid2'))
{
var columnCfgs = [
{
width: 175,
text: 'Date Changed',
},
{
text: 'State Change',
width: 335,
},
{
text: 'Author',
dataIndex: '_User',
width: 175,
}];
this._createGrid(......);
}
},
不幸的是,没有办法从回溯中补充用户 api。不过那会很甜蜜!
您现在最好的选择是在回溯数据返回后查询 wsapi 以获取您需要补水的所有用户。是这样的吗?
_onSnapshotStoreLoad: function(store) {
var userOids = _.uniq(_.map(store.getRange(), function(record) { return record.get('_User'); }));
Ext.create('Rally.data.wsapi.Store', {
autoLoad: true,
model: 'User',
filters: [{ property: 'ObjectID', operator: 'in', value: userOids.join(',')}]
});
}
然后当该商店加载时,您可以将数据合并到您的回顾数据中并像以前一样创建您的网格。
我正在使用 LookBack 获取历史修订信息。 我得到 _User 值,它是一个用户 ID。 我将如何去检索相应的用户名?
我玩过 ModelFactories 但没有成功。
//use lookback api to retrieve user story info
_createRevisionInfo: function(record, item)
{
var userStoryID = item.get('FormattedID');
var userStoryName = item.get('Name');
var snapShotFilters = this._getSnapShotFilters(userStoryName, userStoryID);
//create store
this.snapshotStore = Ext.create('Rally.data.lookback.SnapshotStore',
{
fetch: ['ScheduleState', '_ValidFrom', 'PlanEstimate', '_User'],
autoLoad: true,
filters: snapShotFilters,
hydrate: ['ScheduleState'],
sortOnFilter: true,
sortonload: true,
.
.
});
},
_onSnapShotStoreLoad: function()
{
if(!this.down('#my-grid2'))
{
var columnCfgs = [
{
width: 175,
text: 'Date Changed',
},
{
text: 'State Change',
width: 335,
},
{
text: 'Author',
dataIndex: '_User',
width: 175,
}];
this._createGrid(......);
}
},
不幸的是,没有办法从回溯中补充用户 api。不过那会很甜蜜!
您现在最好的选择是在回溯数据返回后查询 wsapi 以获取您需要补水的所有用户。是这样的吗?
_onSnapshotStoreLoad: function(store) {
var userOids = _.uniq(_.map(store.getRange(), function(record) { return record.get('_User'); }));
Ext.create('Rally.data.wsapi.Store', {
autoLoad: true,
model: 'User',
filters: [{ property: 'ObjectID', operator: 'in', value: userOids.join(',')}]
});
}
然后当该商店加载时,您可以将数据合并到您的回顾数据中并像以前一样创建您的网格。