Rally 如何按父故事的格式化id对用户故事网格进行排序
我试图向Rally.data.WsapiDataStore添加一个分类器,但它不起作用。 是否可以按父字段排序Rally 如何按父故事的格式化id对用户故事网格进行排序,rally,Rally,我试图向Rally.data.WsapiDataStore添加一个分类器,但它不起作用。 是否可以按父字段排序 Ext.create('Rally.data.WsapiDataStore', { model: 'UserStory', fetch: ['FormattedID','Name','HasParent','Parent'], pageSize: 100, autoLoad: true,
Ext.create('Rally.data.WsapiDataStore', {
model: 'UserStory',
fetch: ['FormattedID','Name','HasParent','Parent'],
pageSize: 100,
autoLoad: true,
sorters: [
{
property: 'Parent.FormattedID',
direction: 'DESC'
}
],
listeners: {
load: this._onDataLoaded,
scope: this
}
});
此外,我还尝试按“HasParent”进行筛选,但也不起作用
filters: [
{
property: 'HasParent',
operator: '=',
value: true
}
]
谢谢 下面是一个示例,其中网格按父故事的FormattedID排序。分拣机被添加到Rally.data.custom.Store,而不是Rally.data.WsapiDataStore
<!DOCTYPE html>
<html>
<head>
<title>TCofUS</title>
<script type="text/javascript" src="/apps/2.0rc1/sdk.js"></script>
<script type="text/javascript">
Rally.onReady(function () {
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function() {
Ext.create('Rally.data.WsapiDataStore', {
model: 'UserStory',
fetch: ['FormattedID','Name','HasParent','Parent'],
pageSize: 100,
autoLoad: true,
listeners: {
load: this._onDataLoaded,
scope: this
}
});
},
_createGrid: function(stories) {
this.add({
xtype: 'rallygrid',
store: Ext.create('Rally.data.custom.Store', {
data: stories,
pageSize: 100,
sorters: [
{
property: 'Parent',
direction: 'DESC'
}
],
}),
columnCfgs: [
{
text: 'Formatted ID', dataIndex: 'FormattedID', xtype: 'templatecolumn',
tpl: Ext.create('Rally.ui.renderer.template.FormattedIDTemplate')
},
{
text: 'Name', dataIndex: 'Name'
},
{
text: 'Parent', dataIndex: 'Parent',
renderer: function(parent) {
return ('<a href="' + Rally.nav.Manager.getDetailUrl(parent) + '">' + parent + '</a>');
}
}
]
});
},
_onDataLoaded: function(store, data){
var stories = [];
Ext.Array.each(data, function(story) {
var parent = story.get('Parent');
var s = {
FormattedID: story.get('FormattedID'),
Name: story.get('Name'),
_ref: story.get("_ref"),
Parent: (parent && parent.FormattedID) || 'None',
};
stories.push(s);
},
this);
this._createGrid(stories);
}
});
Rally.launchApp('CustomApp', {
name:"TCofUS",
//parentRepos:""
});
});
</script>
<style type="text/css">
.app {
/* Add app styles here */
}
</style>
</head>
<body></body>
</html>
使用过滤器的另一种方法是只在父级上进行过滤!='' ]
Parent: (parent && parent.FormattedID) || 'None'
filters: [
{
property: 'Parent',
operator: '!=',
value: ''
}