Observing sporadic problem with fnGetPosition and fnGetData
Observing sporadic problem with fnGetPosition and fnGetData
Hi,
I am using version 1.10.1 and facing a problem with fnGetPosition and fnGetData functions sporadically. Here's a small snippet of the code I am using -
$("#tableName tbody).on("click","td",function(){
var aPos=$("#tableName").dataTable().fnGetPosition(this);
var aData=$("#tableName").dataTable().fnGetData(aPos[0]);
});
Now this works just fine 80% of the time, but there are times when, instead of returning the actual values, aPos gets this value -
[
function(){
var ret=fn.apply(scope,arguments);
//Method extension
_Api.extend(ret,ret,struct.methodExt);
return ret;
}
,undefined,
function(){
var ret=fn.apply(scope,arguments);
//Method extension
_Api.extend(ret,ret,struct.methodExt);
return ret;
}
]
Some function definitions seem to have crept into aPos, instead of the row and column indices.
Consequently, aData gets null value and the code that follows fails.
I tried to pin the problem down to fnGetPositon() and decided to avoid calling this. Instead I tried this -
var aData=$("#tableName").dataTable().fnGetData($(this).parent('tr'));
But even with this, there are times when aData gets a null value. I tried stepping into the code usind the non-minified version, but could figure out what's going wrong. I am unable to replicate this problem at will. Like I have mentioned before, this is only happening sporadically about 20% of the times and I haven't been able to establish a clear pattern to willfully replicate the problem yet. Any idea what could be causing this problem?
Thanks
Replies
Possibly that might occur if the data is null - but I would need a test case to be able to replicate the issue to be able to debug it.
However, I would very much suggest that rather than using the old style API, use the new one - it should be must easier:
Note the capital
D
in$().DataTable()
to access the new API!Allan