editor 2.1.2 upgrade, field plugin select2 error.
editor 2.1.2 upgrade, field plugin select2 error.
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
aught TypeError: this.field is not a function
at Object.set (editor.select2.js:178:30)
at R.update (editor.select2.js:308:37)
at O._typeFn (dataTables.editor.min.js:6:64085)
at O.update (dataTables.editor.min.js:6:62292)
at O.<anonymous> (dataTables.editor.min.js:6:39240)
at Function.each (vendor.min.js:148:24)
at R.Ce [as _optionsUpdate] (dataTables.editor.min.js:6:39155)
at HTMLDocument.<anonymous> (dataTables.editor.min.js:6:74864)
at HTMLDocument.dispatch (vendor.min.js:1612:261)
at v.handle (vendor.min.js:1574:93)
set: function (conf, val) {
****var field = this.field(conf.name); <-- error!!!!!!!!****
if (conf.separator && !Array.isArray(val)) {
val = val === null
? []
: val.split(conf.separator);
}
// Clear out any existing tags
if (conf.opts && conf.opts.tags) {
conf._input.val([]);
}
Description of problem:
1.9.6 editor and old plugin select2 script ok!
but 2.1.2 upgrade and new select2 script that error.
how??
This question has accepted answers - jump to:
Answers
That's surprising! It seems to work for me locally here with 2.1.2, and checking the code it should do.
this, in that context is the host Editor, and it does have afield()method.Can you PM me a link to your page so I can debug it please?
Thanks,
Allan
Message sent.
Thanks for your help.
I think this could be the same problem i addressed here:
https://datatables.net/forums/discussion/76184/select2-with-options-in-php#latest
In my case it has something to do with the options being declared in the php file. If i take them out it works like expected.
@wouter - Apologies. I totally missed your thread on this topic.
I think you've nailed the issue - the
updateisn't calling thesetmethod with the correct scope.Replace:
with
And that will fix it. I'll get the site updated with that change.
Allan
edited Corrected order!
Hey Allan,
Cool! I think you mean the other way araound, right?
Replace:
With:
Because that works for me
Doh - yes! Thanks and good to hear that fixed it.
Allan
Ok! i fixed it.
but bootstrap5 theme not work. maybe z-index problem.
i add css this.
.select2-dropdown {
z-index: 1061;
}
z-index: 1051 -> 1061
Now Work correct.
Thanks!!!!