Skip to content

Commit

Permalink
#6139 table.plugin.CellEditing base class and importing the plugin in…
Browse files Browse the repository at this point in the history
…to table as needed
  • Loading branch information
tobiu committed Dec 16, 2024
1 parent 7329c1d commit f83b2d5
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/table/cellEditing/MainContainer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class MainContainer extends ConfigurationViewport {
*/
createExampleComponent() {
return Neo.create(TableContainer, {
id : 'myTableStoreContainer',
cellEditing : true,
selectionModel: CellModel,
store : MainStore,

Expand Down
28 changes: 28 additions & 0 deletions src/table/Container.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions src/table/plugin/CellEditing.mjs
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit f83b2d5

Please sign in to comment.