itemIdを指定してコンポーネントを取得する場合は、2種類の方法がある。
Ext.Queryable.downと、Ext.Queryable.queryByIdの2つ。
queryByIdのソース見るとdownを呼んでいるだけなので、itemIdの先頭に#をつけるのが好きか嫌いかだけの問題ですかね。
queryById: function(id){
return this.down('#' + id);
},
Ext.onReady ->
# 表示するビューオブジェクト
view = null
# 画面の構築
cfg =
layout:'border'
items:[
region:'center'
layout:'fit'
tbar:[
text:'test1'
handler: ->
# 親→子方向に検索 itemIdには、先頭に#を付ける
item = view.down("#txtArea")
console.log item.getValue()
,
text:'test2'
handler: ->
# itemIdには、先頭に#を付けない
item = view.queryById("txtArea")
console.log item.getValue()
]
items:
xtype:'codemirror'
theme: 'blackboard'
mode: "text/x-coffeescript"
itemId:'txtArea' # <- itemIdを指定
showToolbar:false
# 画面の表示
view = Ext.create("Ext.Viewport",cfg)