I need to write some action based on the refresh button in the Paging toolbar. How can I override the doRefresh()
method?
this.bbar=Ext.create('Ext.PagingToolbar', {
store: store,
displayInfo: true,
displayMsg: 'Displaying records {0} - {1} of {2}',
emptyMsg: "No topics to display"
});
If you just want to do is once use
Ext.create('Ext.PagingToolbar', {
store: store,
displayInfo: true,
displayMsg: 'Displaying records {0} - {1} of {2}',
emptyMsg: "No topics to display",
doRefresh : function(){
// Keep or remove these code
var me = this,
current = me.store.currentPage;
if (me.fireEvent('beforechange', me, current) !== false) {
me.store.loadPage(current);
}
}
});
or for all pagebars.
Ext.PagingToolbar.prototype.doRefresh = function() {
// Keep or remove these code
var me = this,
current = me.store.currentPage;
if (me.fireEvent('beforechange', me, current) !== false) {
me.store.loadPage(current);
}
}
Note that if you doing so you have to double check it each time you update the EXTJS core to ensure functionality!
Ext.create('Ext.PagingToolbar', {
store: store,
displayInfo: true,
displayMsg: 'Displaying records {0} - {1} of {2}',
emptyMsg: "No topics to display",
doRefresh : function(){
var me = this,
current = me.store.currentPage;
if (me.fireEvent('beforechange', me, current) !== false) {
me.store.loadPage(1, {
callback: function (records, operation, success) {
Ext.getCmp('educationGrid').getSelection(records, operation, success);
}
});
}
}
});
...................................
getSelection: function(records, operation, success){
var grid= Ext.getCmp('educationGrid'); //my grid
grid.getView().select(0);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With