I'm creating an ExtJS 5.1.1 demo app. Try to give a refs
for refresh button of gridpanel, so that I'll able to set a function for reload the data inside the grid.
I guess that I can't create correct refs
for both Grid panel and Refresh button. Therefore click event is not working.
MainView:
Ext.define('MultiDB.view.DBMainView', {
extend: 'Ext.container.Viewport',
alias: 'widget.dbmainview',
requires: [ ... ],
initComponent: function () {
var me = this;
Ext.apply(me, {
items: [{
xtype: 'dbmenupanel',
region: 'west'
}, {
xtype: 'dbgridpanel',
region: 'center'
}, {
xtype: 'dbformpanel',
region: 'south'
}]
});
me.callParent();
}
});
Grid Panel:
Ext.define('MultiDB.view.DBGridPanel', {
extend: 'Ext.grid.Panel',
xtype: 'dbgridpanel',
store: 'FolioStore',
requires: [...],
title: 'ORest DB List',
padding: 1,
itemId: 'gridPanel',
dockedItems: [...],
initComponent: function () {
var me = this;
Ext.apply(me, {
tools: [{
type: 'refresh',
itemId: 'refreshBtn',
tooltip: 'Refresh the DB',
//handler: function () {alert('Click: Refresh Btn');}
}],
columns: [...]
});
me.callParent();
}
});
Controller:
Ext.define('MultiDB.controller.DBMainController', {
extend: 'Ext.app.Controller',
views: ['DBGridPanel'],
refs: {
formPanel: 'dbformpanel#formPanel',
gridPanel: 'dbgridpanel#gridPanel',
mainView: 'dbmainview#mainView',
registrationBtn: 'splitbutton#registrationBtn',
refreshBtn: 'dbmainview dbgridpanel#refreshBtn'
},
init: function (application) {
this.control({
"menuitem[opt]": {
click: this.setFormPanel
},
"dbmainview dbgridpanel#refreshBtn": {
viewready: this.doRefresh
}
});
},
setFormPanel: function (item) {...},
doRefresh: function () {
console.log('this is doInit!');
this.getGridPanel().getStore().load();
}
});