1

我有一个只有 3 个项目的拉力网格。网格会自动显示每页显示 25/50/100/etc 的链接。例如,当我单击 50 时,我只是得到一个恒定的微调器说“正在加载...”,在 JS 控制台中,我收到一个未捕获的错误“无法调用方法'indexOf'...”

我假设这意味着我的数据存储缺少某些东西?

这是网格的东西:

        var resultsModel = Ext.define('ResultsModel', {
            extend: 'Ext.data.Model',
            fields: [
            {name: 'FID', type: 'string'},
            {name: 'TestName', type: 'string'},
            {name: 'TestDuration', type: 'string'},
            {name: 'Verdict', type: 'string'},
            ]       
        });

this.resultsStore = Ext.create('Ext.data.Store', { model: 'ResultsModel', pageSize: 25 });

        this.down('#testResults').add({
                xtype: 'rallygrid',
                store: this.resultsStore,
                width: 800,
                viewConfig: {
                stripeRows: true,
                emptyText: "No test cases run"
                },
                columnCfgs: [
                    {
                        text: 'TestCase', dataIndex: 'FID', width: 65 
                    },
                    {
                        text: 'Test Name', dataIndex: 'TestName', flex: 1
                    },
                    {
                        text: 'Run Time (s)', dataIndex: 'TestDuration', width: 75
                    },                      
                    {
                        text: 'Verdict', dataIndex: 'Verdict', width: 65, 
                        renderer: function(value){
                            if((value == "Fail") || (value == "Error")){
                                return Ext.String.format("<div style='background-color:#F00;color:#FFF;font-weight:bold;text-align:center'>{0}</div>", value);
                            }
                            else{
                                return Ext.String.format("<div style='background-color:#2EFE2E;color:#000;font-weight:bold;text-align:center'>{0}</div>", value);

                            }
                        }
                    }

                ]
            });

这是被推入数据存储区的数据:

    Ext.Array.each(data, function(record) {     
        records.push({
            FID: record.get('TestCase')['FormattedID'],  //record.data.TestCase might work too.
            TestName: record.get('TestCase')['Name'],
            TestDuration: record.get('Duration'),
            Verdict: record.get('Verdict')
        });
    });

    this.resultsStore.loadData(records, false);

Ext 正在迭代的数组中的数据只是测试运行的获取。

这是控制台输出:

Uncaught TypeError: Cannot call method 'indexOf' of undefined sdk-debug.js:5304
Ext.apply.urlAppend sdk-debug.js:5304
Ext.define.buildUrl sdk-debug.js:26016
Ext.define.buildRequest sdk-debug.js:25859
Ext.define.doRequest sdk-debug.js:26059
Ext.define.read sdk-debug.js:25828
Ext.define.load sdk-debug.js:44668
Base.callParent sdk-debug.js:2894
Ext.define.load sdk-debug.js:45283
Ext.define.read sdk-debug.js:44420
Ext.define.loadPage sdk-debug.js:45562
Ext.define.changePageSize sdk-debug.js:96872
(anonymous function) sdk-debug.js:1540
(anonymous function)
wrap
4

1 回答 1

0

你见过这个例子吗?

https://rally1.rallydev.com/apps/2.0p/doc/#!/example/GridWithFreeformData

我们创建了一个与网格配合得很好的商店,它将自动创建一个模型并为您加载您的自定义数据。

于 2012-06-14T21:58:54.110 回答