Reputation: 786
In my project I have used jquery nested datatable,I have 2childs row for each row in datatble, below is my code
$(function(){$(document).on('click','#tab td.control', function(){
var nTr = this.parentNode;
var oData = $('#tab').dataTable().fnGetData(nTr);
console.log(oData);
.....etc.....
});
If I click parent td means the 2 child rows open, and this.parentNode shows the parent node details based on that details , I will shows additional details about parent node,below code for child row,
$(function(){$(document).on('click','table[id^="inner_param_"] td.control', function(){
var nTrs = this.parentNode;
var ooDatas = we.fnGetData(nTrs);
console.log(ooDatas);
.....etc.....
});
If I click parent node first child means that child open and console shows parent node details, but second child not working and console shows null for parent node details
Upvotes: 4
Views: 304
Reputation: 786
Finally got solution,
Just change #tab td.control
to #tab > tbody > tr > td.control
Upvotes: 3