AutoFill Increment shows NaN
AutoFill Increment shows NaN
Link to test case: https://datatables.net/extensions/autofill/examples/initialisation/plugins.html
Debugger code (debug.datatables.net): None that I can see in the console.
Error messages shown: None that I can see.
Description of problem:
When using the AutoFill Increment feature to increment numbers by any amount, the cells are filled by 'NaN'.
On the datatables website linked above, after selecting the first Age value (33), then dragging down the cell down, I get the prompt to Increment/decrement by x, Fill all or Cancel. If I click the up arrow to change the amount to increment by, the dialog dissapears and the cells are filled with 'NaN'. Even if I click in the box to change the amount to increment/decrement by, it causes the same behavior.
I cannot get this working and assume it's something to with it handling numbers as strings and failing?
I've tried in Firefox, Chrom and Edge. All have the same behaviour.
Answers
Debugger code:
https://debug.datatables.net/azulen
This is the only example I've found to be working but I'm not sure what the difference is between it and my code.
https://jsfiddle.net/rk2n8up4/2/
The fiddle you found uses Autofill 2.3.4 where the example uses 2.6.0. I updated the fiddle to use 2.6.0 and the NaN error is recreated.
https://jsfiddle.net/rm9nzube/1/
I would say you are correct that the numbers are being handled as strings and the error was introduced after 2.3.4. @allan will need to take a look.
Kevin
Thanks Kevin,
I'll wait to hear from @allan.
Tom
I ended deleting the existing 'increment' functionality and writing my own (very similar, copied and pasted) version of an increment and decrement which has things working again.
My suspicion is there is something wrong with the <input> field in the popup with the updown field. I've resorted to a 'Increment' and a 'Decrement' option without the ability to change the number to count by. I only need to go up or down by 1 so it's not a problem for me.
The actual code of the 'execute' sections is copied straight from the source.
Apologies - you are absolutely right. There is a bug in the current release of AutoFill for the increment button. I've committed a fix and it will be in the nightly shortly and the next release of AutoFill.
Allan
Thank you so much!
This is by far the best editor datatable tool I've used! Thanks again!
Thank you!