Sencha Touch 2 コントローラーからビューへの参照を取得したいと思います。これは次のようになります (CoffeeScript):
Ext.define 'MyApp.view.Books',
extend: 'Ext.Panel'
id: 'books'
config:
html: 'Hello, Books!'
Ext.define 'MyApp.controller.Books',
extend: 'Ext.app.Controller'
views: [
'Books'
]
init: ->
@control
'#books':
render: ->
console.log 'This is never called. Why?'
show: ->
console.log 'This is called twice.'
# @getBooksView() is not a view instance, it is a class. Why?
console.log 'View class: ' + @getBooksView()?.$isClass
Ext.application
name: 'MyApp'
controllers: [
'Books'
]
launch: ->
Ext.Viewport.setActiveItem
xtype: 'booksview'
'Hello, Books' コンテンツが表示されます (たとえば、コンポーネントがレンダリングされます) が、レンダー コントロール ハンドラーが呼び出されることさえありません。ここで何が間違っていますか?