今天在做项目中,遇到了选择panel下 tools里的一个button元素,搞了半天,终于试出来了,为了将来便于查看,记录如下:
panel结构如下:
{
xtype: 'panel',
title: '联网状态',
action: 'netStatus',
border: 0,
width: '100%',
layout: 'fit',
flex: 2,
tools: [
{
xtype: 'numberfield',
name : 'refreshTime',
action : 'timeAction',
fieldLabel: '刷新时间(秒)',
labelAlign: 'right',
step: 1,
maxValue: 9999,
minValue: 0
}
,{
xtype : 'button',
action : 'refreshBtn',
text : '刷新',
margin : '0 0 0 5'
}
],
items:[{
xtype: 'dataview',
store: 'SOnlineState',
autoScroll : true,
tpl : Ext.create('Ext.XTemplate',
'<div class="dataset_out_panel">',
' <tpl for=".">',
'<div class="dataset_out">',
'<div class="form_icon_a">',
'<img src="{src}" title= "{orgName}" /><br><span>{orgName}</span>',
'</div>',
'</div>',
' </tpl>',
'<div class="clear"></div>',
'</div>'
),
emptyText: 'No images available'
}]
}
拿到刷新按钮的选择器: panel[action="netStatus"] button[action="refreshBtn"]