1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-01-19 12:52:11 +01:00

Fix: Child rows which were given as TR elements were not being added

- The child row feature of DataTables should be able to take a `tr`
  element and add that directly as a child. That wasn't working due to a
  logic error before.
This commit is contained in:
Allan Jardine 2014-03-06 08:47:42 +00:00
parent 6a568a7542
commit c32f4c032a
2 changed files with 14 additions and 5 deletions

View File

@ -1 +1 @@
3034e3ba43fcfd7bb6ae6d95e566d9eca284c35a a6c7cb0ca4c65e14d41f7c339c9f1190c11453b8

View File

@ -7569,12 +7569,21 @@
// Convert to array of TR elements // Convert to array of TR elements
var rows = []; var rows = [];
var addRow = function ( r, k ) { var addRow = function ( r, k ) {
if ( ! r.nodeName || r.nodeName.toUpperCase() !== 'tr' ) { // If we get a TR element, then just add it directly - up to the dev
r = $('<tr><td></td></tr>').find('td').html( r ).parent(); // to add the correct number of columns etc
if ( r.nodeName && r.nodeName.toLowerCase() === 'tr' ) {
rows.push( r );
} }
else {
// Otherwise create a row with a wrapper
var created = $('<tr><td/></tr>');
$('td', created)
.addClass( k )
.html( r )
[0].colSpan = _fnVisbleColumns( ctx );
$('td', r).addClass( k )[0].colSpan = _fnVisbleColumns( ctx ); rows.push( created[0] );
rows.push( r[0] ); }
}; };
if ( $.isArray( data ) || data instanceof $ ) { if ( $.isArray( data ) || data instanceof $ ) {