煎茶觸摸2集標籤我是新來的MVC結構煎茶觸摸2.在控制器
在我看來,我有一個標籤,如下所示:
{ 的xtype:「標籤」, 的itemId: '標題', HTML: '標題' }
在我的控制,我該如何設置這個標籤的價值?
目前我控制器(工作過的教程樣本):
Ext.define( 「NotesApp.controller.Notes」,{
extend: "Ext.app.Controller", config: { refs: { // We're going to lookup our views by xtype. noteView: "noteview", noteEditorView: "noteeditorview", notesList: "#notesList" }, control: { noteView: { // The commands fired by the notes list container. noteNextCommand: "onNoteNextCommand", noteAnswerCommand: "onNoteAnswerCommand" }, noteEditorView: { // The commands fired by the note editor. saveNoteCommand: "onSaveNoteCommand", deleteNoteCommand: "onDeleteNoteCommand", backToHomeCommand: "onBackToHomeCommand" } } }, onNoteNextCommand: function() { var noteView = this.getNoteView(); console.log("loaded view"); //set label here }, // Base Class functions. launch: function() { this.callParent(arguments); var notesStore = Ext.getStore("Notes"); notesStore.load(); console.log("launch"); }, init: function() { this.callParent(arguments); console.log("init"); } });
衆目睽睽代碼:
Ext.define(「NotesApp.view.Note」,{ extend:「Ext.Container」, 別名: 「widget.noteview」,
config: { layout: { type: 'fit' }, items: [ { xtype: "toolbar", title: "Random Question", docked: "top", items: [ { xtype: 'spacer' }, { xtype: "button", text: 'List', ui: 'action', itemId: "list" } ] }, { xtype: "label", html: 'question', itemId: "question" }, { xtype: "label", html: 'answer', itemId: "answer" } ], listeners: [{ delegate: "#list", event: "tap", fn: "onListTap" }, { delegate: "#question", event: "tap", fn: "onQuestionTap" }, { delegate: "#answer", event: "tap", fn: "onAnswerTap" }] }, onListTap: function() { console.log("list"); this.fireEvent("showList", this); }, onQuestionTap: function() { console.log("noteAnswer"); this.fireEvent('noteAnswer', this); }, onAnswerTap: function() { console.log("noteNext"); this.fireEvent('noteNext', this); } });
也許需要看到你的控制器的代碼 – sirmdawg
我添加了控制器代碼。謝謝! –
基本上我希望答案標籤在問題標籤上點擊時顯示答案 –