extjs - 具有 TestFolders 和 TestCase 层次结构的网格

标签 extjs rally

我需要一个应用程序,其中我的测试用例按照 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/

相关文章:

ExtJS 4 检查类是否存在

javascript - 如何检测容器何时失去焦点

javascript - Extjs 日期字段在我的网格中看起来很奇怪

ExtJS 扩展网格 RowEditor 插件(用于编辑数组)

java - 使用工作区引用获取项目层次结构

javascript - Rally 外部应用程序中的 PortfolioItem 查询

javascript - 如何从javascript数组中删除重复的对象?

java - Rally Rest API 通过缺陷 FormattedID 获取对话帖子

java - 如何使用lookback API获取计划估计变更的功能记录

java - 如果文件夹属于特定根文件夹,如何使用 java 通过 Api to Rally 获取信息