Get particular row data from jquery datatable

user1951007 picture user1951007 · Jan 30, 2013 · Viewed 9.8k times · Source

I want to get a particular row data from jQuery data table. Can anyone help me to get the record with first column id?

function showchnldetail(val) {
    var oTable = $('#example').dataTable();
    var aData = oTable.fnGetData(val);
    if (null != aData) {
        alert('enter');
    }               
}

val is first column id. I want to store the data in a variable.

var aDataSet = [ ['96', 'xx', 'product1', '144']];

I assign the above dataset to otable.

Answer

nesX picture nesX · Feb 7, 2013
var nodes = datatable.fnGetNodes();
var row = null;

jQuery.each(nodes, function(key, fila){
    if(jQuery(fila).attr('id') == idrow){
        row = fila;
    }
});       

var pos = datatable.fnGetPosition(row);
      datatable.fnUpdate('new value', pos, 1);