Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Tags 使用AppSDK 2.0rc1向标记集合添加标记时出错_Tags_Rally - Fatal编程技术网

Tags 使用AppSDK 2.0rc1向标记集合添加标记时出错

Tags 使用AppSDK 2.0rc1向标记集合添加标记时出错,tags,rally,Tags,Rally,尝试添加标记时,我不断遇到以下错误: TypeError:对象没有方法“getModel” 这是我的代码狙击手: _onRecordRead: function(record, operation) { if(operation.wasSuccessful()) { var tagStore = record.getCollection('Tags'); defectStore.add({'_ref':'/tag/1234'});

尝试添加标记时,我不断遇到以下错误: TypeError:对象没有方法“getModel”

这是我的代码狙击手:

_onRecordRead: function(record, operation) {
        if(operation.wasSuccessful()) {
            var tagStore = record.getCollection('Tags');
            defectStore.add({'_ref':'/tag/1234'});
            defectStore.sync({
                    callback: function() {
                        console.log('success');
                    }
            });
        }
    },

我做错了什么?

您可以先通过向getCollection方法传递附加配置来加载存储,加载后,您可以添加并同步:

Ext.define('CustomApp'{ 扩展:“Rally.app.app”, 组件CLS:“应用程序”

launch: function() {
    console.log("launch");
   Rally.data.ModelFactory.getModel({
        type: 'User Story',
        success: this._onModelRetrieved,
        scope: this
    });
},
_onModelRetrieved: function(model) {
    console.log("_onModelRetrieved");
    this.model = model;
    this._readRecord(model);
},

 _readRecord: function(model) {
    var id = 13888228557;
    console.log("_readRecord");
    this.model.load(id, {
        fetch: ['Name', 'Tags'],
        callback: this._onRecordRead,
        scope: this
    });
},

_onRecordRead: function(record, operation) {
    if(operation.wasSuccessful()) {
         var tagStore = record.getCollection('Tags', {
            autoLoad: true,
            listeners: { load: function() {
                tagStore.add({'_ref':'/tag/14749564725'}, {'_ref':'/tag/14749393316'});
                tagStore.sync({
                    callback: function() {
                        console.log('success');
                    }
                });
            }}
        });
    }

}, 
}))