我需要一个应用程序,其中我的测试用例按照 testFolders 层次结构由 TestFolders 显示。例如:
TestFolder1 - SubTestFolder1.1 -- TestCase111 -- TestCase112 -- TestCase113 - SubTestFolder1.2 -- TestCase121 -- TestCase222 TestFolder2 -- TestCase21 -- TestCase22
With expandable TestFolders... I do found some exemples for UserStories but it is not applicable because it uses specific objects as rallyuserstorytree, I understand I should build my own tree model ? But I'm beginner to Rally and I don't really understand how to do it. The inline help as no such exemples...
This gave me a blank page, my callback is never loaded, and it cause an error "Uncaught TypeError: Cannot read property 'length' of undefined" that I don't understand...
var myTreeStore = Ext.create('Rally.data.wsapi.TreeStore', {
model : 'TestFolder',
listeners: {
load: function(store, data, success){
console.log(' in load calback');
//process data
},
scope: this,
},
autoLoad : true,
fetch: [ 'FormattedID', 'TestCases' ,'Description'],
limit: records_nbr,
remoteSort : true ,
sorters: ['FormattedID'],
pagesize: records_nbr,
autoLoad: true,
});
我尝试了另一种方式,例如这段代码:
_createTree: function(){
var me = this ;
var myTree = Ext.create('Ext.Container', {
itemID: 'myTree',
items: [{
xtype: 'rallytree',
topLevelModel: 'TestFolder',
childModelTypeForRecordFn: function(record){
if(record.get('Children') && record.get('Children').length > 0){
return 'TestCase';
} else {
return 'TestFolder';
}
},
givenAParentRecordWhatIsTheAttributeConnectingAChildToThisParentFn: function(record){
if(record.get('Children') && record.get('Children').length > 0){
return 'Parent';
} else {
return 'WorkProduct';
}
},
canExpandFn: function(record){
return true;
}
}
],
renderTo: Ext.getBody().dom,
});
this.add(myTree);
},
但它只显示顶级 TestFolders,无法展开它们。在哪里可以找到在分层网格中显示 TestFolders 和 TestCases 的应用程序示例?
最佳答案
2.0rc2 中包含的 Rally.data.wsapi.TreeStore 仍然很原始。我们目前正在努力更好地支持分层网格数据。您上面发布的示例很可能是为 WSAPI 版本 1.x 设计的,在该版本中仍然可以在一个请求中检索子集合。 2.0rc2 强制使用 WSAPI 2.x,它返回一个集合摘要对象(并且需要额外的请求来填充)。
像下面这样的东西应该更适合你:
record.get('TestCases') && record.get('TestCases').Count > 0
关于extjs - 具有 TestFolders 和 TestCase 层次结构的网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21261349/