效果图:
Grid.js
Ext.define(‘V5.user.view.Grid’, {
extend : ‘Ext.grid.Panel’,
xtype : ‘userGrid’,
tbar : [{
xtype : ‘basebutton’,
text : ‘新建’,
btype : ‘add’
},
‘->’,
{
xtype : ‘rsearch’,
name : ‘xxx’
}],
columns : {
defaults : {
flex : 1
},
items : [{
text : ‘名称’,
dataIndex : ‘name’
}]
}
});
User.js
Ext.define(‘V5.user.controller.User’, {
extend : ‘Ext.app.Controller’,
models : [‘V5.user.model.User’],
stores : [‘V5.user.store.Users’],
views : [‘Grid’],
refs : [{
ref:’Grid’,
selector:’userGrid’
}],
init : function() {
var me = this;
this.control({
‘button’ : {
click : me.doAction
}
});
},
doAction : function(btn) {
var me = this;
Ext.create(‘Ext.window.Window’,{
items:[{
width:500,
height:300,
xtype:’userGrid’
}]
}).show();
}
});