Difficulty rendering using rows.add([objects])
Difficulty rendering using rows.add([objects])
I am using DataTables 1.10.2. I have written scripts to add a row dynamically for array of an object called Division, which includes properties such as DivisionCode, DivisionName, etc.
The problem comes in when I use the render function, to render an input tag to the table with the value of the object's properties (i.e. DivisionCode, DivisionName) in the tag. I keep getting undefined as the value and I notice that the DataTable renders two times. What do I mean by this?
Render function is like this,
render: function (data, type, row, meta){
console.log(row);
return '<input type="text" value="' + row.DivisionCode + '" />';
}
If I add two rows, console.log spits out 4 entries.
How can I fix this?