我构建了一个自定义的纸板混搭来显示所有处于“已提交”迭代中并属于当前项目或任何子项目的用户故事。这很有效。然后我添加了一个所有者下拉框(仅限团队成员),以过滤纸板上的故事。结果查询值的格式似乎很好,但没有显示任何故事。我使用警报复制查询字符串并将其粘贴到自定义网格中,该网格返回预期的故事列表。
下面是我的代码。任何帮助表示赞赏。
var rallyDataSource;
var cardboard;
var ownerDropdown;
function refreshCardboard() {
var cardboardConfig = {
types: ["Defect", "HierarchicalRequirement"],
attribute: "ScheduleState",
fetch: "Name,FormattedID,Owner,ObjectID"
};
var query = rally.sdk.util.Query.and(['Iteration.Name != ""', 'Iteration.State = "Committed"']);
if (ownerDropdown) {
var ownerQuery = ownerDropdown.getValue();
if (ownerQuery != 'ALL') {
query = '(' + query + ' AND Owner.Name = "' + ownerQuery + '")';
}
}
cardboardConfig.query = query;
if (!cardboard) {
cardboard = new rally.sdk.ui.CardBoard(cardboardConfig, rallyDataSource);
cardboard.display("cardboardDiv");
} else {
cardboard.refresh(cardboardConfig);
}
}
function buildOwnerDropdown() {
var teamMembersQuery = {
key: "teamMembers",
type: "User",
fetch: "UserName,DisplayName",
query: '(TeamMemberships = /project/__PROJECT_OID__)'
};
rallyDataSource.findAll(teamMembersQuery, function (results) {
var ownerItems = [{ label: "-- ALL --", value: "ALL"}];
rally.forEach(results.teamMembers, function (teamMember) {
ownerItems.push({ label: teamMember.DisplayName, value: teamMember.UserName });
});
ownerItems.sort();
var ownerDropdownConfig = {
showLabel: true,
label: "Owner:",
items: ownerItems
};
ownerDropdown = new rally.sdk.ui.basic.Dropdown(ownerDropdownConfig);
ownerDropdown.display("ownerDropdownDiv");
});
}
function onLoad() {
rallyDataSource = new rally.sdk.data.RallyDataSource(
'__WORKSPACE_OID__',
'__PROJECT_OID__',
'__PROJECT_SCOPING_UP__',
'__PROJECT_SCOPING_DOWN__');
buildOwnerDropdown();
refreshCardboard();
}
rally.addOnLoad(onLoad);
</script>
</head>
<body>
<div id="ownerDropdownDiv"></div>
<input id="refreshButton" type="button" value="Filter" onclick="refreshCardboard()"/>
<div id="cardboardDiv"></div>
</body>