From f2e4c776952a8171f0d2cdf8badb056d8be1d72f Mon Sep 17 00:00:00 2001 From: konuch Date: Thu, 24 May 2018 08:51:31 +0200 Subject: [PATCH 1/2] Added configurable orderCells index. --- js/core/core.draw.js | 7 +++++++ 1 file changed, 7 insertions(+) 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; + } } } From a33e572d7a1a7da55b2602b7b2b701e161582760 Mon Sep 17 00:00:00 2001 From: konuch Date: Thu, 24 May 2018 08:54:23 +0200 Subject: [PATCH 2/2] Added comments to describe the logic --- js/model/model.defaults.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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