fnUpdate for a single cell with objects
fnUpdate for a single cell with objects
i would like to update a cell with an object. but i am getting error while doing so by fnUpdate . Inside fnRowCallback function i will convert this object to a string and i will put this string in the column. please help me in this.
This discussion has been closed.
Replies
Allan
var mapConfig = {};
mapConfig["key1"] = "value1";
oTable.fnUpdate(mapConfig,index-1,4);
The error that i am getting is "DataTables warning (table id = 'resultsTable'): Requested unknown parameter '0' from the data source for row 0".
if i pass a string in fnUpdate it accepts it.for example the following is working.
oTable.fnUpdate(JSON.stringify(mapConfig),index-1,4);
initially when i loaded the table i passed a map to aData[4] via ajax response. and inside the fnRowCallback i converted it to a string as given below.
var string = '';
var mapConfig = aData[4];
for(var key in mapConfig ) {
string += key;
string += '=';
string += mapConfig [key];
}
$('td:eq(4)', nRow).html(string);
Everything was fine till this point. i stored the object in dataTable. only while loading the table i converted the object(map) to a string inside fnRowCallback for displaying purpose.
My question is the dataTable was accepting a map object while loading it via sAjaxSource. but later when i try to update the stored map object using fnUpdate it is not working. How can i change the stored object. is there any workaround for this?
thanks in advance.