Closed aneathesia closed 3 years ago
You can use event onbeforechange(element, cell, x, y, value)
and return your data casted as you want
for example
onbeforechange: function(el, cell, x, y, value) {
if(el.jspreadsheet.options.columns[x].type == "number") {
return new Number(value);
}
return value;
}
code not tested
Your method really works, and this problem have noted in the document i missed that. In addition, even set the column type to number but after edit the output data type will still mismatch, the problem may in this new return value type. Your code is definitely helpful.Thanks!
Try with that: maybe it's new Number is not good.
onbeforechange: function(el, cell, x, y, value) {
if(el.jspreadsheet.options.columns[x].type == "numeric") {
return +value;
}
return value;
},
I have checked and i have good result in JSON
How do I keep the data type unchanged?