[英]How to Apply Filters to a Rally Grid View
我需要對與Rally Grid關聯的數據存儲應用一些計算的過濾。
這段代碼具有調試“噪聲”的功能,但是它表明我試圖在配置時提供一些過濾器,但它們被忽略了,或者似乎是因為我的過濾器功能未觸發。
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一些注意事項:“過濾器”配置必須是storeConfig的一部分。 在上面的代碼中,它是gridConfig的一部分。
storeConfig: {
filters: [{
property: "Iteration.Name",
value: "Sprint 3"
}]
}
同樣,用於“迭代”屬性的過濾器將期望對迭代引用的引用。 對於該特定實現,您將需要使用屬性:“ Iteration.Name”。 這里有關於查詢和使用點表示法的良好信息:常規查詢示例| CA Agile Central幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.