Pull numeric characters and add spacing from DataTable JSON
Pull numeric characters and add spacing from DataTable JSON
murday1983
Posts: 29Questions: 12Answers: 0
I have a DataTable
which is doing a GET
and populates, The data returned only has one option returned called which is a tel number but the tel num returned has 'test-' in front of it (e.g. test-010101010101).
What i want is to remove the 'test-' and then add spaces after every 4 digits (e.g. 0101 0101 0101).
I have tried the below but cant get it working
"createdRow": function (row, data, dataIndex) {
$('#dialPlanListDataTable').DataTable().rows().eq(0).each(function (index) {
var row = $('#dialPlanListDataTable').DataTable().row(index);
var data = row.data();
console.log(data)
var sd = data.text();
sd = parseInt(sd);
console.log(sd)
});
},
This results in
No idea how to do it at all as i am new to DataTable
s
This discussion has been closed.
Replies
Hi @murday1983 ,
The best place is to do this in
columns.render
. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.Cheers,
Colin