我正在使用2.1 rally SDK编写自定义HTML应用程序。我的任务是:
这是我的代码:
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function () {
Ext.define('User', {
extend: 'Ext.data.Model',
fields: ['FormattedId', 'Name', 'email'],
associations: [
{type: 'hasMany', model: 'UserChild', name: 'UserChild'},
{type: 'hasMany', model: 'Defects', name: 'Defects'},
],
proxy: {
type: 'ajax',
url : './Users.json',
reader: {
type: 'json',
root:'users'
}
},
});
Ext.define("UserChild", {
extend: 'Ext.data.Model',
fields: ['FormattedId', 'Name', 'email'],
belongsTo: 'User'
});
Ext.define("Defects", {
extend: 'Ext.data.Model',
fields: ['FormattedId', 'Name', 'email'],
belongsTo: 'User'
});
var grid=Ext.create('Rally.ui.grid.Grid', {
store: Ext.create('Rally.data.Store', {
model: 'User',
autoLoad:true,
enableHierarchy: true
}),
columnCfgs: [
{
text:'FormattedId' , dataIndex : 'FormattedId'
},
{
text: 'Name', dataIndex: 'Name'
},
{
text:'email' , dataIndex : 'email'
}
]
});
this.add(grid);
}
});
Users.json文件如下:
{
"users": [
{
"FormattedId": 1,
"Name": "Ed Spencer",
"email": "ed@sencha.com",
"UserChild":{
"FormattedId": 3,
"Name": "Ed Spencer",
"email": "ed@sencha.com"
},
"Defects" :{
"FormattedId": 4,
"Name": "Ed Spencer",
"email": "ed@sencha.com"
}
},
{
"FormattedId": 2,
"Name": "Abe Elias",
"email": "abe@sencha.com",
"UserChild":{
"FormattedId": 5,
"Name": "Ed Spencer",
"email": "ed@sencha.com"
},
"Defects" :{
"FormattedId": 6,
"Name": "Ed Spencer",
"email": "ed@sencha.com"
}
}
]
}
我想要一个带有用户数据而不是集会数据存储的分层网格。
答案 0 :(得分:0)
当您尝试从Rally应用程序中获取Jira数据时,我会遇到麻烦。由于CORS,很可能会阻止您这样做。
您将遇到的第二个大问题是,所有Rally SDK对象都基于它们是具有所有正确变量和过程的“记录”对象。层次结构基于各种类型的子级集合,而不是关联。分层网格使这一点变得更加困难,因为它们使用手工制作的一点黑魔法使所有东西都可以一起工作,并且非常易于修改。
祝你好运。