4

私はまだこのチュートリアルを進めようとしていますが、成功はまちまちです。私のコントローラースクリプトには、次のものがあります。

config: {
        refs: {
            notesListContainer: 'noteslistcontainer',
            noteEditor: 'noteeditor'
        },
        control: {
            notesListContainer: {
                newNoteCommand: 'onNewNoteCommand',
                editNoteCommand: 'onEditNoteCommand'
            }
        }
},
onEditNoteCommand: function(list, record) {
    console.log('onEditNoteCommand');

    this.activateNoteEditor(record);
},
activateNoteEditor: function(record) {
        var noteEditor = this.getNoteEditor();
        noteEditor.setRecord(record);
        Ext.Viewport.animateActiveItem(noteEditor, this.slideLeftTransition);
},

これを Chromium 18.0.1025.168 で実行すると、

Uncaught TypeError: Cannot call method 'setRecord' of undefined Notes.js:37`. 
`this.getNoteEditor()' 

noteEditor を返しませんが、undefined を返します。

プロジェクト全体のソースはこちらから入手できます。

4

1 に答える 1

7

重要なことは、参照をautoCreatedとして指定することですautoCreate : true

config: {
    refs: {
        notesListContainer: 'noteslistcontainer',
        noteEditor: {
                 selector: 'noteeditor',
                 xtype: 'noteeditor',
                 autoCreate: true // missing
            }
        },
    },
...
}
于 2012-07-09T16:58:30.820 に答える