Currently, I am involved in a project using ExtJS 6.2 and facing a challenge related to performing operations when the columns in a grid are resized. It seems like the suitable event for this task is columnresize. However, the issue arises because the columns are dynamically loaded from a database, causing this event to be triggered every time a new column is added. My preference would be to restrict this event to only fire after all columns have been loaded.
I attempted to use a flag (named lFirstInit) that would switch to false once the columns are successfully loaded from the database. Unfortunately, the columnresize event continues to trigger right from the beginning.
Any suggestions on how I can tackle this problem? Your help is greatly appreciated. Thank you.
View:
Ext.define('App.view.TMainBrowseGrid', {
extend: 'Ext.grid.Panel',
alias: 'widget.TMainBrowseGrid',
requires: [
'App.view.TMainBrowseGridViewModel',
'App.view.override.TMainBrowseGrid',
'Ext.view.Table',
'Ext.grid.column.RowNumberer',
'App.view.TMainBrowseGridViewController'
],
controller: 'TMainBrowseGrid',
config: {
oParent: null,
cBrwName: '',
cCodForm: ''
},
viewModel: {
type: 'TMainBrowseGrid'
},
flex: 1,
columns: [
{
xtype: 'rownumberer',
itemId: 'oColRowNum'
}
],
listeners: {
columnresize: 'onGridpanelColumnResize',
}
});
Controller
Ext.define('App.view.TMainBrowseGridViewController', {
extend: 'Ext.app.ViewController',
alias: 'controller.TMainBrowseGrid',
onGridpanelColumnResize: function (component, column, width, eOpts) {
// THINGS TO DO...
}
});