diff --git a/js/core/core.draw.js b/js/core/core.draw.js index c97e9bf8a..52d5b2db6 100644 --- a/js/core/core.draw.js +++ b/js/core/core.draw.js @@ -748,6 +748,13 @@ function _fnGetUniqueThs ( oSettings, nHeader, aLayout ) { aReturn[j] = aLayout[i][j].cell; } + + // In case the bSortCellsTop is an integer, insert the header cells to a provided header row index + if ( aLayout[i][j].unique && + (!aReturn[j] || Number.isInteger(oSettings.bSortCellsTop)) ) + { + aReturn[j] = aLayout[oSettings.bSortCellsTop][j].cell; + } } } diff --git a/js/model/model.defaults.js b/js/model/model.defaults.js index 4b0b3f7cc..c3bd2752a 100644 --- a/js/model/model.defaults.js +++ b/js/model/model.defaults.js @@ -702,8 +702,9 @@ DataTable.defaults = { /** * Allows control over whether DataTables should use the top (true) unique * cell that is found for a single column, or the bottom (false - default). + * If an integer is provided, order controls will be inserted into a header row with given index. * This is useful when using complex headers. - * @type boolean + * @type boolean | integer * @default false * * @dtopt Options