mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-18 11: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:
parent
6a568a7542
commit
c32f4c032a
@ -1 +1 @@
|
||||
3034e3ba43fcfd7bb6ae6d95e566d9eca284c35a
|
||||
a6c7cb0ca4c65e14d41f7c339c9f1190c11453b8
|
||||
|
17
media/js/jquery.dataTables.js
vendored
17
media/js/jquery.dataTables.js
vendored
@ -7569,12 +7569,21 @@
|
||||
// Convert to array of TR elements
|
||||
var rows = [];
|
||||
var addRow = function ( r, k ) {
|
||||
if ( ! r.nodeName || r.nodeName.toUpperCase() !== 'tr' ) {
|
||||
r = $('<tr><td></td></tr>').find('td').html( r ).parent();
|
||||
// If we get a TR element, then just add it directly - up to the dev
|
||||
// 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( r[0] );
|
||||
rows.push( created[0] );
|
||||
}
|
||||
};
|
||||
|
||||
if ( $.isArray( data ) || data instanceof $ ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user