DataTable column values

`rowCallback: function(row, data) {
    $('td:eq(0)', row).html('<img src="images/' + data[0] + '" class="uilo" /> <span class="bagu"> ' + data[1] + '</span>');
    
},`

I was using + data[0] + and + data[1] + to get data table columns returned data without

“columns”: [ { “data”: “info1” }, { “data”: “info2” } ],

but when i defined “columns”: in my data table jQuery + data[0] + and + data[1] + nolonger work

“columns”: [ { “data”: “info1” }, { “data”: “info2” } ],

So my question is how to access data values so i can be able to define them, i tried this but looks syntax

“columns”: [ var data1 = { “data”: “info1” }, var data2 = { “data”: “info2” } ],

so i can define them like this

rowCallback: function(row, data) {
$(‘td:eq(0)’, row).html('<img src="images/' + data1 + '" class="uilo" /> <span class="bagu"> ' + data2 + '</span>');

    },


Your columns definition is telling DataTables what data to extract from the object given to it.

“columns”: [ { “data”: “info1” }, { “data”: “info2” } ],
says to DataTables "I’m going to give you some data. It will contain, potentially among other things, entries for “info1” and “info2”.

If you’re trying to use rowCallback…

rowCallback: function(row, data) {
the “data” variable inside that function is the original data object representing that row. So you’d access it the same way you’d access that object of the original data.

Let’s assume, for the moment, that your original data looked something like this:

var inputdata = [{"info1":"Dave", "info2":"Smith"},{"info1":"Ann", "info2":"Doe"}]

To access that inside a normal javascript function, you’d loop through the rows, and then take the row’s object, and reference the .info1 member to get Dave/Ann.

The first time your rowCallback runs,
row = <the tr element corresponding to this row>
data = {"info1":"Dave", "info2":"Smith"}

So you’d access the word “Dave” by data.info1.

thank you