0

在从 Rally 获取特定标签以计算另一个字段中的值中的讨论之后,我开始重写自定义应用程序以扩展 Rally 的 UserStory 模型,以向其中添加自定义字段,以便于显示和用户输入。在模型工厂的成功函数中,我使用模型的扩展来添加我的字段,但仅此一项就使 SDK 失败并出现以下错误: Uncaught TypeError: Cannot read property 'compile' of undefined

事实上,它无法在模型中实例化我的自定义字段。Ext.Class.NewClass 似乎需要一个名为 tpl (模板?)的属性,该属性未为我的自定义字段定义。我尝试过使用该领域的各种属性,但没有成功,我继续遇到同样的错误。

堆栈如下:

Ext.define.constructor (sdk-debug.js:81499)
Base.callParent (sdk-debug.js:2894)
Ext.define.constructor (sdk-debug.js:110488)
Ext.Class.newClass (sdk-debug.js:3191)
(anonymous function) (:2)
Ext.ClassManager.instantiate (sdk-debug.js:3951)
Ext.ClassManager.instantiateByAlias (sdk-debug.js:3901)
(anonymous function) (sdk-debug.js:1558)
Ext.define.create (sdk-debug.js:15370)
Ext.define.createComponent (sdk-debug.js:28150)
Ext.define.lookupComponent (sdk-debug.js:28138)
Ext.define.prepareItems (sdk-debug.js:28113)
Ext.define.add (sdk-debug.js:28198)
Ext.define.add (sdk-debug.js:28188)
Ext.define.initItems (sdk-debug.js:28017)
Ext.define.initComponent (sdk-debug.js:28001)
Base.callParent (sdk-debug.js:2894)
Ext.define.initComponent (sdk-debug.js:79700)
Ext.define.constructor (sdk-debug.js:15617)
Base.callParent (sdk-debug.js:2894)
Ext.define.constructor (sdk-debug.js:27106)
Ext.Class.newClass (sdk-debug.js:3191)
(anonymous function) (:2)
Ext.ClassManager.instantiate (sdk-debug.js:3951)
(anonymous function) (sdk-debug.js:1558)
Ext.define.initComponent (sdk-debug.js:77226)
Base.callParent (sdk-debug.js:2894)
Ext.define.initComponent (sdk-debug.js:78944)
Base.callParent (sdk-debug.js:2894)
Ext.define.initComponent (sdk-debug.js:111030)
Ext.define.constructor (sdk-debug.js:15617)
Base.callParent (sdk-debug.js:2894)
Ext.define.constructor (sdk-debug.js:27106)
Base.callParent (sdk-debug.js:2894)
Ext.define.constructor (sdk-debug.js:110959)
Ext.Class.newClass (sdk-debug.js:3191)
(anonymous function) (:2)
Ext.ClassManager.instantiate (sdk-debug.js:3951)
Ext.ClassManager.instantiateByAlias (sdk-debug.js:3901)
(anonymous function) (sdk-debug.js:1558)
Ext.define.create (sdk-debug.js:15370)
Ext.define.createComponent (sdk-debug.js:28150)
Ext.define.lookupComponent (sdk-debug.js:28138)
Ext.define.prepareItems (sdk-debug.js:28113)
Ext.define.add (sdk-debug.js:28198)
Rally.data.ModelFactory.getModel.success (rallytest.html:34) // this is my app call to this.add of the grid
onGetModelsSuccess (sdk-debug.js:106084)
onFetchSuccess (sdk-debug.js:106142)
Ext.define._onTypeDefinitionsRetrieved (sdk-debug.js:106227)
Ext.define._fetchTypeDefinitions.Rally.environment.getIoProvider.httpGet.success (sdk-debug.js:106246)
Ext.apply.callback (sdk-debug.js:5286)
success (sdk-debug.js:105221)
Ext.apply.callback (sdk-debug.js:5286)
Ext.define.handleResponse (sdk-debug.js:53177)
(anonymous function) (sdk-debug.js:1540)
(anonymous function) (TypeDefinition.js:1)

这是(当前)代码:

        Ext.define('BVApp', {
            extend: 'Rally.app.App',
            componentCls: 'app',
            layout: {
                align: 'stretch'
            },

            launch: function() {
                Rally.data.ModelFactory.getModel({
                type: 'UserStory',

                success: function(model) {

                    this.grid = this.add({
                        xtype: 'rallygrid',
                        model: Ext.define('BVModel', {
                            extend: model,
                            alias : 'BVModel',
                            fields: [
                                {name: 'Bv1', type: 'string', persist: false, tpl: 'test',
                                    serialize: function(v, record){ record.data.score = v; },
                                    convert: function(v, record){ return record.data.score; }
                                }
                            ]
                        }),
                        columnCfgs: [
                            {
                                text: 'FormattedID', dataIndex: 'FormattedID'
                            },
                            {
                                text: 'ref', dataIndex: 'ref'
                            },
                            {
                                text: 'Name', dataIndex: 'Name', flex: 1
                            },
                            {
                                text: 'Score', dataIndex: 'Score'
                            }
                        ]
                    });

                    }, // end of getModel success
                    scope: this
                });
            }
        });
4

1 回答 1

0

通过调用 2.0p3 SDK 而不是 2.0p2 解决。

于 2012-09-24T13:01:01.693 回答