Reformat Column To Hyperlink from JSON Web Service
Reformat Column To Hyperlink from JSON Web Service
I have a simple data table populated via a JSON feed. One of the columns has a partial path
"\wells\Arizona\EastCarrizo\E145O.pdf"
What I need to do is rather than just dump it into the table as I am here (which works fine)
$('#example').dataTable({
"bProcessing": true,
"sAjaxSource": '/api/UraniumLogs?district=none',
"sAjaxDataProp": "",
"aoColumns": [
{ "mDataProp": "HOLE_NUM" },
{ "mDataProp": "STATE" },
{ "mDataProp": "DISTRICT" },
{ "mDataProp": "CLAIM" },
{ "mDataProp": "COLLAR_ELEVATION" },
{ "mDataProp": "DEPTH" },
{ "mDataProp": "FILENAME" },
]
});
but actually wrap and append some hyperlink goodness to the FILENAME column and then inject it into the table. Something like
"http://hostname/" + FILENAME;
I have read a bunch of stuff about later versions of DataTables recognizing HTML hyperlinks and using fnRenderer (which is apparently deprecated) but am stuck.
Thanks in advance.
"\wells\Arizona\EastCarrizo\E145O.pdf"
What I need to do is rather than just dump it into the table as I am here (which works fine)
$('#example').dataTable({
"bProcessing": true,
"sAjaxSource": '/api/UraniumLogs?district=none',
"sAjaxDataProp": "",
"aoColumns": [
{ "mDataProp": "HOLE_NUM" },
{ "mDataProp": "STATE" },
{ "mDataProp": "DISTRICT" },
{ "mDataProp": "CLAIM" },
{ "mDataProp": "COLLAR_ELEVATION" },
{ "mDataProp": "DEPTH" },
{ "mDataProp": "FILENAME" },
]
});
but actually wrap and append some hyperlink goodness to the FILENAME column and then inject it into the table. Something like
"http://hostname/" + FILENAME;
I have read a bunch of stuff about later versions of DataTables recognizing HTML hyperlinks and using fnRenderer (which is apparently deprecated) but am stuck.
Thanks in advance.
This discussion has been closed.
Replies
[code]
{
mData: "FILENAME",
mRender: function (data, type, row) {
return 'View';
}
}
[/code]
Allan