Reformat Column To Hyperlink from JSON Web Service

Reformat Column To Hyperlink from JSON Web Service

gguntherggunther Posts: 2Questions: 0Answers: 0
edited December 2012 in General
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.

Replies

  • allanallan Posts: 63,531Questions: 1Answers: 10,474 Site admin
    edited December 2012
    Sounds like you want mRender:

    [code]
    {
    mData: "FILENAME",
    mRender: function (data, type, row) {
    return 'View';
    }
    }
    [/code]

    Allan
  • gguntherggunther Posts: 2Questions: 0Answers: 0
    Thanks. That was much simpler than I thought. Feel like a dope.
This discussion has been closed.