In order to extend javascript functionality of grid, we need to be able to dynamically plug additional features to it.
Here's an idea of how it could be done:
// column-toggle-handler.js
class ColumnToggleHandler() {
run(event, grid) {
// do stuff
}
}
// some/specific/page/script.js
const grid = new Grid('#my-grid');
// you just add handlers that you actually need
// it can be the same for column, grid actions & etc.
// maybe fire some event so modules/other script can register their own handlers for the grid
grid.addColumnHandler(new ColumnToggleHandler());
grid.init();
In order to extend javascript functionality of grid, we need to be able to dynamically plug additional features to it.
Here's an idea of how it could be done: