Proper way to obtain the backing javascript object for a row?
Proper way to obtain the backing javascript object for a row?
Given an element is there a simple way to obtain the backing javascript object for a row? Currently I've added my own getData function to a table to fetch the value, but I feel like I'm in a place I should not be and that there should be an API for what I'm trying to do.
This is the code that is working for me at the moment, but like I said, probably can be better, safer.
{code}
table[ 'getData' ] = function(element) {
var aPos = table.fnGetPosition( element );
var row = aPos[0];
// Not thrilled with what I would consider a private property _aData. Still searching for better solution.
var data = table.dataTable().fnSettings().aoData[row]._aData;
return data;
}
{code}
This is the code that is working for me at the moment, but like I said, probably can be better, safer.
{code}
table[ 'getData' ] = function(element) {
var aPos = table.fnGetPosition( element );
var row = aPos[0];
// Not thrilled with what I would consider a private property _aData. Still searching for better solution.
var data = table.dataTable().fnSettings().aoData[row]._aData;
return data;
}
{code}
This discussion has been closed.
Replies
[code]
var data = oTable.fnGetData( element );
[/code]
should do it. Or am I missing something? :-)
Allan