0

在尝试使用 Rally.data.BulkRecordUpdater 时,我遇到了一些问题。首先,文档不正确。提供的示例:

Rally.data.BulkRecordUpdater({
    records: [record1, record2],
    propertiesToUpdate: {
        Parent: '/hierarchicalrequirement/123.js'
    },
    success: function(readOnlyRecords){
        //all updates finished, except for given read only records
    },
    scope: this
});

应该:

Rally.data.BulkRecordUpdater.updateRecords({
    records: [record1, record2],
    propertiesToUpdate: {
        Parent: '/hierarchicalrequirement/123.js'
    },
    success: function(readOnlyRecords){
        //all updates finished, except for given read only records
    },
    scope: this
});

其次,当尝试使用此方法更新记录时,我不断收到无法调用方法“get”的错误 - 我假设这是因为我提供的记录格式不正确。我只是在从 wsapi 查询中提取的记录上调用它。我尝试将对象放在另一个对象中:

{data: record}

但它似乎仍然没有帮助。任何想法将不胜感激!

4

2 回答 2

0

如果有帮助,请参阅此示例

            _justFunction: function(_childObj) {
                records = ["abc", "xyz"];
                var store = Ext.create('Rally.data.custom.Store', {
                    data: records,
                    listeners: {
                        load: that._updateAll,
                        scope: that
                    },     
                });
            },  
            _updateAll: function(store,data) {
                Rally.data.BulkRecordUpdater.updateRecords({
                    records: data,
                    propertiesToUpdate: {
                        Parent: _newParent.get("_ref")
                    },
                    success: function(readOnlyRecords){
                        //all updates finished, except for given read only records
                    },
                    scope: that
                });
            },
于 2014-09-30T12:08:59.020 回答
0

感谢您指出文档问题。我正在提交一个缺陷来解决这个问题。

记录应该是 Rally.domain.WsapiModel 的实例。如果您使用 Rally.data.WsapiDataStore 来检索它们,那么您应该已经准备就绪。你在做不同的事情吗?

值得一提的是,我们目前还在研究另一种更好的方法来批量更新记录。在未来的 SDK 中寻找它!

于 2013-09-23T15:57:06.077 回答