Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow orderCellsTop to be provided with row index integer #124

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions js/core/core.draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion js/model/model.defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down