Error with dataTable().fnAddData()
Error with dataTable().fnAddData()
bmahmoud5
Posts: 2Questions: 1Answers: 0
var abc = [
{ "accountCode": "01", "accountName": "avc", "parentAccount": "-", "finalAccount": "ww", "chartLevel": "1" },
{ "accountCode": "02", "accountName": "rtg", "parentAccount": "-", "finalAccount": "ee", "chartLevel": "1" }
]
$('#datatable1').dataTable().fnAddData(abc);
console.log(abc);
It displays:
abc = [
{ "accountCode": 1, "accountName": "avc", "parentAccount": "-", "finalAccount": "ww", "chartLevel": "1" },
{ "accountCode": 2, "accountName": "rtg", "parentAccount": "-", "finalAccount": "ee", "chartLevel": "1" }
]
wht it remove the leading zero?
Thanks
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This question has an accepted answers - jump to answer
Answers
I've just tried it here with the
rows.add()
API method (rather than fnAddData which is legacy and will be removed sometime soon): https://live.datatables.net/pajurabu/1/edit . It appears to work okay.Are you able to modify it to show the issue?
Allan
Many thanks Allan. It was a browser issue.