0
我试图做同样的应用程序与miamicode之间切换,我在第3步 http://miamicoder.com/2012/how-to-create-a-sencha-touch-2-app-part-3/煎茶触摸 - 观点
我尽量让这变为新的笔记(开关按钮,一个新的屏幕,创建一个新的注释)
在例子中的代码是这样的:
onNewNoteCommand: function() {
console.log("onNewNoteCommand");
var now = new Date();
var noteId = (now.getTime()).toString() + (this.getRandomInt(0, 100)).toString();
var newNote = Ext.create("NotesApp.model.Note", {
id: noteId,
dateCreated: now,
title: "",
narrative: ""
});
this.activateNoteEditor(newNote);
}
的activateNotesList功能是这样的:
activateNotesList: function() {
Ext.Viewport.animateActiveItem(this.getNotesListView(), this.slideRightTransition);
我自己的例子,我试着去编辑视图而不传递数据。 ,所以我试试这个:
onNewNoteCommand:function()
{
var noteEditor = this.getNoteEditor();
// Ext.Viewport.add(noteEditor); also tried this.
Ext.Viewport.setActiveItem(noteEditor);
的代码没有任何错误运行,但屏幕不会改变。 有什么建议吗?添加什么差异?
我如何设置视口(还没有创建任何自定义视口)卡?这是setactiveitem不起作用的问题吗?任何其他方式来切换视图?
以及我没有错误。 但noteEditor的类型是undifiend ... 这是我noteEditor如何开始: Ext.define( “noteditor.view.NoteEditor”,{ 扩展: “Ext.form.Panel”, 别名: “widget.noteeditor”, \t要求: “Ext.form.FieldSet”, \t \t 配置:{布局:{类型: 'VBOX'}}, \t初始化:功能(){.. ... 和控制器我有一个参考 Ext.define( “noteditor.controller.Notes”,{ 延伸: “Ext.app.Controller”, \t配置:{ \t \t参:{ \t \t \t notesListContainer: “主”, \t \t \t noteEditor: “noteeditor” \t \t \t}, \t \t控制:{ \t \t \t \t \t \t \t \t}}, – Giannis
我不应该用这个ref得到一个noteeditor视图吗? – Giannis
你应该这样写:Ext.define(“noteditor.view.NoteEditor”,{extend:“Ext.form.Panel”,xtype:'noteeditor'.....并且你的ref noteEditor不会被定义为 –