您是否获取“主题”?
您可能会看到一个通用示例,该示例构建了一个迭代网格,该迭代网格位于一个发布(在 releasecombobox 中选择)中,只要迭代输入了一个主题,就在这个 github repo中填充了 Theme 列。
此示例与 IterationSummary 应用程序不同,因为在我的示例中,我为 Iteration 对象显式创建了 Rally.data.wsapi.Store 并获取主题。
自定义 IterationSummary 应用程序仍需要显式获取 Theme 字段,但您是正确的,从 IterationSummary 应用程序中获取其他字段的方式并不明显,例如迭代状态。该应用程序中的迭代对象是从中返回的this.getContext().getTimeboxScope().getRecord()
,如果您在控制台中打印出该对象,则主题将为空。存在的字段this.getContext().getTimeboxScope().getRecord()
是有限的,出于性能原因无法自定义。
为了修改此应用程序以显示主题,必须访问迭代模型并显式获取主题。以下是我修改应用程序的步骤:
添加 getTheme 功能:
getTheme: function(){
var iteration = this.getContext().getTimeboxScope().getRecord();
return iteration.self.load(iteration.getId(), {
fetch: ['Theme']
});
}
在 rc3 中,每次我们有记录时,.self
都会给出它的模型,因此无需手动执行此操作:
Rally.data.ModelFactory.getModel({
type: 'Iteration',
//...
笔记fetch: ['Theme']
接下来,调用inside_addContent
方法getTheme()
return Deft.Promise.all([this.getTheme(), this.calculateTimeboxInfo()]).then({
success: function(results) {
var theme = results[0].get('Theme');
然后最后将主题变量的值传递给:
{
cls: 'theme',
html: theme
}
完整代码可在此 github repo中找到。