Hi!
in 2.1.7 I had this class:
class TaskEditor extends TaskEditor {
static get defaultConfig() {
return {
width: '50em',
height: '36em',
extraItems: {
generaltab: [
{
html : '',
cls : 'b-divider',
flex : '1 0 100%'
}, {
type : 'tagsfield',
ref : 'tagsField',
name : 'tags',
label : "Tags",
flex : '0 100%',
cls : 'b-inline'
}
],
advancedtab: [{
type: 'checkbox',
label: "Initially expanded",
name: 'initiallyExpanded',
ref: 'initiallyExpandedField',
flex: '1 0 50%',
}]
}
};
}
}
I followed this guide to migrate to 4.5.1: https://www.bryntum.com/docs/gantt/#Gantt/guides/upgrades/4.0.0.md#taskeditor-configs-changes
The guide is for the TaskEdit feature but I figured the changes were the same for class configuration. Maybe I was wrong. We'll see Anyway I came up with this:
class MyTaskEditor extends TaskEditor {
static get type() {
return 'mytaskeditor';
}
static get defaultConfig() {
return {
autoClose: false,
width: '50em',
height: '36em',
items: {
generalTab: {
items: {
spacer1: {
html : '',
cls : 'b-divider',
flex : '1 0 100%'
},
tags: {
type : 'tagsfield',
ref : 'tagsField',
label : "Tags",
flex : '0 100%',
cls : 'b-inline'
}
}
},
advancedTab: {
items: {
initiallyExpanded: {
type: 'checkbox',
label: "Initially expanded",
ref: 'initiallyExpandedField',
flex: '1 0 50%',
}
}
},
},
};
}
}
And as usual, I use this to set the task editor class:
new Gantt({
appendTo : 'container',
features : {
taskEdit : {
editorClass: MyTaskEditor
}
},
// ...
});
Currently, there is a problem with editorClass which is already discussed here . However, using the workaround I included, I managed to get it to work, but then I have a crash because of the items part in the defaultConfig:
TypeError: clonedItems.find is not a function
I think it expects the items
config to be an array but the documentation says it can be an object. I tried to set it as an array like so:
static get defaultConfig() {
return {
autoClose: false,
width: '50em',
height: '36em',
items: [
{
ref: 'generalTab',
items: {
spacer1: {
html : '',
cls : 'b-divider',
flex : '1 0 100%'
},
tags: {
type : 'tagsfield',
ref : 'tagsField',
label : "Tags",
flex : '0 100%',
cls : 'b-inline'
}
}
},
{
ref: 'advancedTab',
items: {
initiallyExpanded: {
type: 'checkbox',
label: "Initially expanded",
ref: 'initiallyExpandedField',
flex: '1 0 50%',
}
}
},
],
};
}
But then I get another error:
TypeError: Cannot read property 'items' of undefined
If I remove the items
config from defaultConfig, then it works fine.