Update editor 1.3.1->1.5.2, editor.set fail
Update editor 1.3.1->1.5.2, editor.set fail
Hello, we've updated from above version of editor, and datatables to 1.10.10, and now a few editor.set doesn't work.
Two editor.set are next to each other, one works to one form field, while the other doesn't work. We're wondering if there's something different in how the table writing php file works, because it worked in 1.3.1, but doesn't now.
File that is in error: Datatables.editor.min.js
The error we get is 'TypeError: b is undefined', and it references line 18, col 317, and points to b.length. The word 'multiValues' is right before the b.length reference.
In testing, we've tried many variations to eliminate possibilities, and the problem drills down to it's the form field name, as we can replace all other parts, and it works Ok.
Thanks for any help you can provide.
This question has an accepted answers - jump to answer
Answers
Hi,
Could you show me how you are calling the
set()
method? Are you chaining it, using objects for the values, or anything else?Thanks,
Allan
these two above make the fail i referred to. the res.value and res.label come back correctly. This above snippet is after the editor section in the JS file.
This section happens right after the above snippet:
and this works correctly.
The top part works correctly in 1.3.1 of editor, using datatables 1.10.0. After moving to 1.5.2 and 1.10.10, it gives the error i listed.
I'm thinking it's pointing to table writes, or something similar, as I can move the second editor.set up to the 'select' section, and it works OK. So it must be fields related me thinks.
We've found an issue that explains the problem above. Below is your 'Field Types' example, which we loaded locally, and changed. Note that we put an event listener on the 'priority' select and had it act on the 'item' field, which we moved below the field that we put the event listener on. This worked OK for us in 1.3.1 editor, but now breaks in 1.5.2.
If you uncomment the upper 'item' field and comment the bottom 'item' field, it works OK.
Hi,
Thanks for letting me know about this - I've just committed a fix that will stop the Javascript error from occurring - however, Editor now fires a synchronous
change
event when setting the value of the select input. The result is that yourset
value is written immediately, but then subsequently overwritten when Editor sets the value for the field (it sets the field values sequentially, which is why the field order matters as you noted above).I'm looking into how best address this and will post back when I've investigated further.
Regards,
Allan
Hi,
I've just committed a change to Editor that will address this in the 1.5.4 release which I currently plan for this coming Friday (4th Dec 2015).
The
change
events are now asynchronous to allow the field values to all be set from the DataTable data, and then thechange
event handler can set the values as required.Regards,
Allan
Thanks much. We will incorporate 1.5.4 when it's out.