From f83b2d50c39306325905e130e1cb09f9c512a274 Mon Sep 17 00:00:00 2001 From: tobiu Date: Mon, 16 Dec 2024 15:54:36 +0100 Subject: [PATCH] #6139 table.plugin.CellEditing base class and importing the plugin into table as needed --- examples/table/cellEditing/MainContainer.mjs | 2 +- src/table/Container.mjs | 28 ++++++++++++++++++++ src/table/plugin/CellEditing.mjs | 26 ++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/table/plugin/CellEditing.mjs diff --git a/examples/table/cellEditing/MainContainer.mjs b/examples/table/cellEditing/MainContainer.mjs index 784923a87..1e4deb16d 100644 --- a/examples/table/cellEditing/MainContainer.mjs +++ b/examples/table/cellEditing/MainContainer.mjs @@ -99,7 +99,7 @@ class MainContainer extends ConfigurationViewport { */ createExampleComponent() { return Neo.create(TableContainer, { - id : 'myTableStoreContainer', + cellEditing : true, selectionModel: CellModel, store : MainStore, diff --git a/src/table/Container.mjs b/src/table/Container.mjs index b65ad1e26..3c9f94f27 100644 --- a/src/table/Container.mjs +++ b/src/table/Container.mjs @@ -27,6 +27,11 @@ class Container extends BaseContainer { * @member {String[]} baseCls=['neo-table-container'] */ baseCls: ['neo-table-container'], + /** + * true uses table.plugin.CellEditing + * @member {Boolean} cellEditing_=false + */ + cellEditing_: false, /** * Default configs for each column * @member {Object} columnDefaults=null @@ -150,6 +155,29 @@ class Container extends BaseContainer { me.createColumns(me.columns) } + /** + * Triggered after the cellEditing config got changed + * @param {Boolean} value + * @param {Boolean} oldValue + * @protected + */ + afterSetCellEditing(value, oldValue) { + if (value) { + import('./plugin/CellEditing.mjs').then(module => { + let me = this, + {windowId} = me, + plugins = me.plugins || []; + + plugins.push({ + module : module.default, + windowId + }); + + me.plugins = plugins + }) + } + } + /** * Triggered after the columns config got changed * @param {Object[]|null} value diff --git a/src/table/plugin/CellEditing.mjs b/src/table/plugin/CellEditing.mjs new file mode 100644 index 000000000..9c5c22f90 --- /dev/null +++ b/src/table/plugin/CellEditing.mjs @@ -0,0 +1,26 @@ +import Base from '../../core/Base.mjs'; + +/** + * @class Neo.table.plugin.CellEditing + * @extends Neo.core.Base + */ +class CellEditing extends Base { + static config = { + /** + * @member {String} className='Neo.table.plugin.CellEditing' + * @protected + */ + className: 'Neo.table.plugin.CellEditing' + } + + /** + * @param {Object} config + */ + construct(config) { + super.construct(config); + + console.log('Neo.table.plugin.CellEditing', this.id); + } +} + +export default Neo.setupClass(CellEditing);