render method loading issue
render method loading issue
New user trying to override render functionality for the 7th column of a server side generated data set with anonymous columns names.
The function below derived from the example works fine if I use replace but replaceAll causes it to hang on loading.
I can probably work around this within a loop that checks manually if there's more work to do but I'd rather the 'All' method of this and matchAll be at my disposal.
Also, is there syntax that'd allow me to just override the 7th column rather than providing placeholders as I've done below?
Dave
$(document).ready(function() {
$('#example').DataTable( {
"ajax": "api/Grid/1", columns: [{}, {}, {}, {}, {}, {}, {}, {
render: function(data, type) {
if (type === 'display') {
let test = String('one fish, two fish, red fish, blue fish');
test = test.replaceAll(/fish/, 'foo')
return test;
}
return data;
}
} ]
} )
});
This question has an accepted answers - jump to answer
Answers
I put your code into this test case:
http://live.datatables.net/cinehamu/1/edit
You will see this error in the browser's console:
Anytime the Datatable doesn't seem to load properly or have the proper formatting look in the browser's console for errors.
The replaceAll() docs state this:
Here is the working example with the global flag:
http://live.datatables.net/kulahire/1/edit
You can use
columnDefs
which I have in the example.Kevin
Awesome! Many thanks