Adding a $ sign in front of text

Adding a $ sign in front of text

enviousenvious Posts: 1Questions: 1Answers: 0
edited November 2014 in Free community support

I'm loading data via ajax and I can't figure out how to implement a simple $ sign in front of the columns that are numbers.

"columns": [
{"data": "Number"}
]

How do I add a doller sign for this columns.data option?

This question has an accepted answers - jump to answer

Answers

  • ignignoktignignokt Posts: 146Questions: 4Answers: 39
    edited November 2014 Answer ✓

    I think the best solution is to do this on the server-side before the json data is returned. This is one way to do it on the front-end. I'm not sure if there is a better way, but it works.

    "columns": [ {"data": "Number",
        "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
            $(nTd).text('$'+sData);
        }
    }]
    
This discussion has been closed.