Nat*_*nes 4 sencha-touch sencha-touch-2
我仍在努力完成本教程,但取得了不同程度的成功.在我的控制器脚本中,我有以下内容:
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);
},
Run Code Online (Sandbox Code Playgroud)
当我在Chromium 18.0.1025.168中运行时,我得到了
Uncaught TypeError: Cannot call method 'setRecord' of undefined Notes.js:37`.
`this.getNoteEditor()'
Run Code Online (Sandbox Code Playgroud)
不返回noteEditor,但返回undefined.
整个项目的来源可在此处获得.
重要的是将ref指定为autoCreated使用 autoCreate : true
config: {
refs: {
notesListContainer: 'noteslistcontainer',
noteEditor: {
selector: 'noteeditor',
xtype: 'noteeditor',
autoCreate: true // missing
}
},
},
...
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2774 次 |
| 最近记录: |