如何将过滤器应用于 Rally 网格视图
How to Apply Filters to a Rally Grid View
我需要对与 Rally Grid 关联的数据存储应用一些计算过滤。
这段代码进行了一些调试 "noise," 但它表明我试图在配置时提供一些过滤器,但它们被忽略了,或者似乎是因为我的过滤器功能没有射击。
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function () {
//Write app code here
console.log("Overall App Launch function entered");
//API Docs: https://help.rallydev.com/apps/2.1/doc/
}
});
Rally.onReady(function () {
Ext.define('BOA.AdoptedWork.MultiArtifactGrid', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function () {
console.log("onReady Launch function entered");
this.theGrid = {
xtype: 'rallygrid',
showPagingToolbar: true,
showRowActionsColumn: false,
editable: false,
columnCfgs: [
'FormattedID',
'Name',
'ScheduleState',
'Iteration',
'Release',
'PlanEstimate',
'TaskEstimateTotal',
'TaskActualTotal', // For some reason this does not display ?? :o( ??
'TaskRemainingTotal'
],
listeners: {
afterrender: {
fn: function (_myVar, eOpts) {
console.log("Arg to afterrender: ", _myVar, " and ", eOpts);
console.log("Filters: ", _myVar.filters);
var _myStore = _myVar.getStore();
console.log("Store : ", _myStore);
console.log("Store filters: ", _myStore.filters);
}
}
},
filters: [{
// This did not work ...
property: 'ScheduleState',
operator: '==',
value: 'Defined',
// Trying dynamic Filter Function. Update: Never called.
filterFn: function (item) {
console.log("Entered Filter Function!");
var iter = item.get("Iteration");
console.log("Iteration field: ", iter);
if (iter !== null && iter !== undefined) {
return (iter.name === "Sprint 3");
} else {
return false;
}
}
}],
context: this.getContext(),
storeConfig: {
models: ['userstory', 'defect']
},
scope: this
};
this.add(this.theGrid);
console.log("The Grid Object: ", this.theGrid);
}
});
Rally.launchApp('BOA.AdoptedWork.MultiArtifactGrid', {
name: 'Multi-type Grid'
});
});
我已经 12 年没有编写代码了,之前从未在 JavaScript 中编写过代码。所以,我明白了。
集会社区中有人提供了答案和有用的反馈:
corkr03 说...
@miguelfuerte 一些事情:
"filters" 配置需要成为 storeConfig 的一部分。在您上面的代码中,它是 gridConfig 的一部分。
storeConfig: {
filters: [{
property: "Iteration.Name",
value: "Sprint 3"
}]
}
此外,属性 of "Iteration" 的筛选器需要对 Iteration 引用的引用。对于该特定实现,您将需要使用 属性: "Iteration.Name"。这里有关于查询和使用点符号的很好的信息:General Query Examples | CA Agile Central 帮助
我需要对与 Rally Grid 关联的数据存储应用一些计算过滤。
这段代码进行了一些调试 "noise," 但它表明我试图在配置时提供一些过滤器,但它们被忽略了,或者似乎是因为我的过滤器功能没有射击。
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function () {
//Write app code here
console.log("Overall App Launch function entered");
//API Docs: https://help.rallydev.com/apps/2.1/doc/
}
});
Rally.onReady(function () {
Ext.define('BOA.AdoptedWork.MultiArtifactGrid', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function () {
console.log("onReady Launch function entered");
this.theGrid = {
xtype: 'rallygrid',
showPagingToolbar: true,
showRowActionsColumn: false,
editable: false,
columnCfgs: [
'FormattedID',
'Name',
'ScheduleState',
'Iteration',
'Release',
'PlanEstimate',
'TaskEstimateTotal',
'TaskActualTotal', // For some reason this does not display ?? :o( ??
'TaskRemainingTotal'
],
listeners: {
afterrender: {
fn: function (_myVar, eOpts) {
console.log("Arg to afterrender: ", _myVar, " and ", eOpts);
console.log("Filters: ", _myVar.filters);
var _myStore = _myVar.getStore();
console.log("Store : ", _myStore);
console.log("Store filters: ", _myStore.filters);
}
}
},
filters: [{
// This did not work ...
property: 'ScheduleState',
operator: '==',
value: 'Defined',
// Trying dynamic Filter Function. Update: Never called.
filterFn: function (item) {
console.log("Entered Filter Function!");
var iter = item.get("Iteration");
console.log("Iteration field: ", iter);
if (iter !== null && iter !== undefined) {
return (iter.name === "Sprint 3");
} else {
return false;
}
}
}],
context: this.getContext(),
storeConfig: {
models: ['userstory', 'defect']
},
scope: this
};
this.add(this.theGrid);
console.log("The Grid Object: ", this.theGrid);
}
});
Rally.launchApp('BOA.AdoptedWork.MultiArtifactGrid', {
name: 'Multi-type Grid'
});
});
我已经 12 年没有编写代码了,之前从未在 JavaScript 中编写过代码。所以,我明白了。
集会社区中有人提供了答案和有用的反馈:
corkr03 说...
@miguelfuerte 一些事情: "filters" 配置需要成为 storeConfig 的一部分。在您上面的代码中,它是 gridConfig 的一部分。
storeConfig: {
filters: [{
property: "Iteration.Name",
value: "Sprint 3"
}]
}
此外,属性 of "Iteration" 的筛选器需要对 Iteration 引用的引用。对于该特定实现,您将需要使用 属性: "Iteration.Name"。这里有关于查询和使用点符号的很好的信息:General Query Examples | CA Agile Central 帮助