What has fnAddData+fnRender been replaced with in >1.10?

What has fnAddData+fnRender been replaced with in >1.10?

nathanjonesnathanjones Posts: 2Questions: 1Answers: 0
edited September 2014 in Free community support

As I'm updating our code using datatables <1.10, I'm having trouble finding a method for the replacement way to use to the fnAddData function.

Right now, we pass in an array that looks like this:

var data = [
    {
        "field":"value1",
        
    }
       ,{
        "field":"value2",
        
    },{
        "field":"value3",
    }
]

pass in the above object doing something like:

$dataTable.fnAddData(data);

and three render functions in our aoColumnDefs options;

"aoColumnDefs": [
                {
                    "fnRender": function (oObj) {
                        var result = '';
                        var info = oObj.aData[1];
                        // Do render
                        return result;
                    },
                    "aTargets": [0]
                },
                {
                    "fnRender": function (oObj) {
                        var result = '';
                        var info = oObj.aData[2];
                        // Do render
                        return result;
                    },
                    "aTargets": [1]
                },
                {
                    "fnRender": function (oObj) {
                        var result = '';
                        var info = oObj.aData[3];
                        // Do render
                    },
                    "aTargets": [2]
                }
            ]

So each function gets all of the data, but we only need to access one element in the array for each column.

What is the preferred way to achieve this without using fnRender/render functions now that fnRender is deprecated?

Answers

This discussion has been closed.