How can I change the text of a cell with data defined in ColumnDef?
How can I change the text of a cell with data defined in ColumnDef?

I have a datatable with 5 columns. The last column is the only one that I have defined in columnDef because it will always start with the content: [ + ], indicating you can click it to expand. Once clicked and expanded, i want it to change to: [ - ]. I first tired defining the content by defaultContent, but I couldnt not obtain that data to edit. I then tried doing:
"columnDefs": [ {
"targets": 5,
"className": '',
"data": function ( data, type, full, meta ) {
return '<span><a>[ + ]</a></span>';
}
},
By doing this, I can see the data by outputting,
data = table.cell(row,5).data();
console.log("DATA:::::: " + data);
But for some reason I cannot change the cell data by doing:
table.cell(row,5).data('<span><a>[ - ]</a></span>').draw();
Why is this? What would be a good way to change the text on click? I by doing the method above, I am able to change all the other fields on click but not the columnDef generated data.
Note: The other data is populated by javascript data ( [ [stuff, stuff,] , [stiff, stuff] ])
Thanks!