2

我试图在我的查询中获取 200 多个元素。因此,我已根据此文档修改了查询应返回的结果限制,但这不起作用。任何的想法?

我正在尝试以下操作:

var tasksWithActualsQuery = Ext.create('Rally.data.WsapiDataStore', 
{
    model: 'Task',
    limit: Infinity,
    fetch: ['CreationDate', 'Actuals'],
    filters: 
    [     
        {
            property: 'CreationDate',
            operator: '<',
            value: 'LastMonth'
        }
    ]
});

tasksWithActualsQuery.load({
    callback: function(records, operation) 
    {
        if(operation.wasSuccessful()) 
        {
            var tasksWithActualsCount = 0;

            Ext.Array.each(records, function(record) {
                if (record.get('Actuals') != null)
                {
                    tasksWithActualsCount++;
                }
            });

            var tasksCount = records.length;
            alert(tasksCount);
        }
    }
});                
4

1 回答 1

2

您的代码是正确的 - 重要部分是限制:无限。

不幸的是,似乎有一个缺陷 - Rally.data.WsapiDataStore 没有将正确的参数从加载调用传递给您的回调函数。只是通过store而不是records,操作成功。

在修复缺陷之前,这应该可以帮助您:

tasksWithActualsQuery.load({
    callback: function(store) {
        var tasksWithActualsCount = 0;

        store.each(function(record) {
            if (record.get('Actuals') != null) {
                tasksWithActualsCount++;
            }
        });

        var tasksCount = store.getTotalCount();
        alert(tasksCount);
    }
});
于 2013-07-26T19:15:44.090 回答