Is it possible to swap the end of a URL from .xml to .html in the columnDefs area?
Is it possible to swap the end of a URL from .xml to .html in the columnDefs area?

I want to change the URL being pulled in from JSON from a .xml to a .html. Is that possible?
This question has an accepted answers - jump to answer
Answers
You can use
columns.render
to modify the data.Kevin
I've tried all kinds of options with no luck. Not sure this is even a dataTables issue as much as a script issue. This is what I'm using:
{
"targets": [7],
"data": "url",
"render": function ( data, type, row, meta ) {
return '<a class="catalog-link" href="'+data+'">'+'View in Catalog'+'</a>';
},
}
Would I add code here to change the end of the URL from .xml to .html? I can't figure out how to change what's in the +data+ area. Or if this is even the correct place to do it.
I don't know what value
data
contains but if you want to replace text then use a Javascript text replace method like replace(). For example:Kevin
That worked! I didn't know I could put the javascript directly attached to the data. Thank you so much!