MCPcopy Create free account
hub / github.com/breck7/scroll / _fnFeatureHtmlTable

Function _fnFeatureHtmlTable

external/.datatables.js:4586–4723  ·  view source on GitHub ↗

* Add any control elements for the table - specifically scrolling * @param {object} settings dataTables settings object * @returns {node} Node to add to the DOM * @memberof DataTable#oApi

(settings)

Source from the content-addressed store, hash-verified

4584 * @memberof DataTable#oApi
4585 */
4586 function _fnFeatureHtmlTable(settings) {
4587 var table = $(settings.nTable)
4588
4589 // Scrolling from here on in
4590 var scroll = settings.oScroll
4591
4592 if (scroll.sX === "" && scroll.sY === "") {
4593 return settings.nTable
4594 }
4595
4596 var scrollX = scroll.sX
4597 var scrollY = scroll.sY
4598 var classes = settings.oClasses.scrolling
4599 var caption = settings.captionNode
4600 var captionSide = caption ? caption._captionSide : null
4601 var headerClone = $(table[0].cloneNode(false))
4602 var footerClone = $(table[0].cloneNode(false))
4603 var footer = table.children("tfoot")
4604 var _div = "<div/>"
4605 var size = function (s) {
4606 return !s ? null : _fnStringToCss(s)
4607 }
4608
4609 if (!footer.length) {
4610 footer = null
4611 }
4612
4613 /*
4614 * The HTML structure that we want to generate in this function is:
4615 * div - scroller
4616 * div - scroll head
4617 * div - scroll head inner
4618 * table - scroll head table
4619 * thead - thead
4620 * div - scroll body
4621 * table - table (master table)
4622 * thead - thead clone for sizing
4623 * tbody - tbody
4624 * div - scroll foot
4625 * div - scroll foot inner
4626 * table - scroll foot table
4627 * tfoot - tfoot
4628 */
4629 var scroller = $(_div, { class: classes.container })
4630 .append(
4631 $(_div, { class: classes.header.self })
4632 .css({
4633 overflow: "hidden",
4634 position: "relative",
4635 border: 0,
4636 width: scrollX ? size(scrollX) : "100%"
4637 })
4638 .append(
4639 $(_div, { class: classes.header.inner })
4640 .css({
4641 "box-sizing": "content-box",
4642 width: scroll.sXInner || "100%"
4643 })

Callers 2

_fnAddOptionsHtmlFunction · 0.85
_fnLayoutDomFunction · 0.85

Calls 2

sizeFunction · 0.85
$Function · 0.70

Tested by

no test coverage detected