corrisoft / jquery-datatables-row-grouping

Automatically exported from code.google.com/p/jquery-datatables-row-grouping
0 stars 0 forks source link

Possible bug in row selector with nested tables #78

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create HTML markup with nested tables, e.g. table > tbody > tr > td > table 
...
2. Attach datatables and rowGrouping()
3. Experience a 'TypeError: oSettings.aoData[iRow] is undefined'

What is the expected output? What do you see instead?
Table should render correctly, however an error is issued instead.

What version of the product are you using? On what operating system?
- jquery 1.10.2
- jquery.dataTables 1.9.4
- jquery.dataTables.grouping  1.2.9

Please provide any additional information below.
The error is thrown in function _fnGetCellData of DataTables beacause 'iRow' 
evaluates to null. This apparently results from a previous call to 
fnNodeToDataIndex to get the index of a particular row. Upon inspection, it 
seems that the selection of the table rows also yield rows of a nested table. 
fnNodeToDataIndex then returns null for nested TRs because they cannot be 
translated to a valid index.

So I think the problem lies in table row selection: 
$('tbody tr', oTable)
in the code selects all TRs found in the table instead the first-child ones.

Patch proposal:
- change line 391 to something like: 
  var nTrs = $('> tbody > tr', oTable);
- change line 598 to something like:
  var nTrs = $('> tbody > tr', oTable);

Original issue reported on code.google.com by foorens...@googlemail.com on 8 May 2014 at 7:44