菜单里按钮选择器
选择器:'vDrugManager>toolbar>splitbutton[splitMark="categoryMark"]>menuitem[action="add_peer_category"]'
作用:获取view视图中的新增同级分类按钮
controller代码:
//新增同级分类按钮 { ref : 'addPeerCateBtn', selector : 'vDrugManager>toolbar>splitbutton[splitMark="categoryMark"]>menuitem[action="add_peer_category"]' }
view代码:
Ext.define('bdic.view.drug.VDrugManager', { extend : 'Ext.panel.Panel', alias : 'widget.vDrugManager', requires : [], border : false, layout : 'border', initComponent : function() { var me = this; Ext.applyIf(me, { dockedItems : [ { xtype : 'toolbar', dock : 'top', items : [ { xtype:'splitbutton', splitMark : 'categoryMark', text: '分类', iconCls: 'add16', menu: [ { text: '新增同级分类', action : 'add_peer_category' }, {text: '新增子分类'}, {text: '编辑分类'}, {text: '删除分类'} ] } ,'-' , { xtype:'splitbutton', text: '药品种类', iconCls: 'add16', menu: [ {text: '新增药品种类'}, {text: '编辑药品种类'}, {text: '删除药品种类'}, {text: '设置有效期'} ] } ,'-' , { xtype:'splitbutton', text: '药品规格', iconCls: 'add16', menu: [ {text: '新增规格'}, {text: '编辑规格'}, {text: '删除规格 '}, {text: '设置有效期'} ] } ,'-' , { xtype: 'button', text: '关闭', iconCls:'close', action:'close' } ] } ] }); me.callParent(arguments); } });
界面如下:
2.query的用法:拿到一个对象,可以使用query获取该对象里指定的元素
function() { var grid = me.getBillForm().query('grid[action=get]')[0]; grid.getStore().add({}); }