').append(button) : button;\n\t}\n});\n\nDataTable.ext.buttons.collection.className += ' dropdown-toggle';\nDataTable.ext.buttons.collection.rightAlignClassName = 'dropdown-menu-right';\n\n\nexport default DataTable;\n","/*! Buttons for DataTables 3.1.2\n * © SpryMedia Ltd - datatables.net/license\n */\n\nimport jQuery from 'jquery';\nimport DataTable from 'datatables.net';\n\n// Allow reassignment of the $ variable\nlet $ = jQuery;\n\n\n// Used for namespacing events added to the document by each instance, so they\n// can be removed on destroy\nvar _instCounter = 0;\n\n// Button namespacing counter for namespacing events on individual buttons\nvar _buttonCounter = 0;\n\nvar _dtButtons = DataTable.ext.buttons;\n\n// Custom entity decoder for data export\nvar _entityDecoder = null;\n\n// Allow for jQuery slim\nfunction _fadeIn(el, duration, fn) {\n\tif ($.fn.animate) {\n\t\tel.stop().fadeIn(duration, fn);\n\t}\n\telse {\n\t\tel.css('display', 'block');\n\n\t\tif (fn) {\n\t\t\tfn.call(el);\n\t\t}\n\t}\n}\n\nfunction _fadeOut(el, duration, fn) {\n\tif ($.fn.animate) {\n\t\tel.stop().fadeOut(duration, fn);\n\t}\n\telse {\n\t\tel.css('display', 'none');\n\n\t\tif (fn) {\n\t\t\tfn.call(el);\n\t\t}\n\t}\n}\n\n/**\n * [Buttons description]\n * @param {[type]}\n * @param {[type]}\n */\nvar Buttons = function (dt, config) {\n\tif (!DataTable.versionCheck('2')) {\n\t\tthrow 'Warning: Buttons requires DataTables 2 or newer';\n\t}\n\n\t// If not created with a `new` keyword then we return a wrapper function that\n\t// will take the settings object for a DT. This allows easy use of new instances\n\t// with the `layout` option - e.g. `topLeft: $.fn.dataTable.Buttons( ... )`.\n\tif (!(this instanceof Buttons)) {\n\t\treturn function (settings) {\n\t\t\treturn new Buttons(settings, dt).container();\n\t\t};\n\t}\n\n\t// If there is no config set it to an empty object\n\tif (typeof config === 'undefined') {\n\t\tconfig = {};\n\t}\n\n\t// Allow a boolean true for defaults\n\tif (config === true) {\n\t\tconfig = {};\n\t}\n\n\t// For easy configuration of buttons an array can be given\n\tif (Array.isArray(config)) {\n\t\tconfig = { buttons: config };\n\t}\n\n\tthis.c = $.extend(true, {}, Buttons.defaults, config);\n\n\t// Don't want a deep copy for the buttons\n\tif (config.buttons) {\n\t\tthis.c.buttons = config.buttons;\n\t}\n\n\tthis.s = {\n\t\tdt: new DataTable.Api(dt),\n\t\tbuttons: [],\n\t\tlistenKeys: '',\n\t\tnamespace: 'dtb' + _instCounter++\n\t};\n\n\tthis.dom = {\n\t\tcontainer: $('<' + this.c.dom.container.tag + '/>').addClass(\n\t\t\tthis.c.dom.container.className\n\t\t)\n\t};\n\n\tthis._constructor();\n};\n\n$.extend(Buttons.prototype, {\n\t/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\t * Public methods\n\t */\n\n\t/**\n\t * Get the action of a button\n\t * @param {int|string} Button index\n\t * @return {function}\n\t */ /**\n\t * Set the action of a button\n\t * @param {node} node Button element\n\t * @param {function} action Function to set\n\t * @return {Buttons} Self for chaining\n\t */\n\taction: function (node, action) {\n\t\tvar button = this._nodeToButton(node);\n\n\t\tif (action === undefined) {\n\t\t\treturn button.conf.action;\n\t\t}\n\n\t\tbutton.conf.action = action;\n\n\t\treturn this;\n\t},\n\n\t/**\n\t * Add an active class to the button to make to look active or get current\n\t * active state.\n\t * @param {node} node Button element\n\t * @param {boolean} [flag] Enable / disable flag\n\t * @return {Buttons} Self for chaining or boolean for getter\n\t */\n\tactive: function (node, flag) {\n\t\tvar button = this._nodeToButton(node);\n\t\tvar klass = this.c.dom.button.active;\n\t\tvar jqNode = $(button.node);\n\n\t\tif (\n\t\t\tbutton.inCollection &&\n\t\t\tthis.c.dom.collection.button &&\n\t\t\tthis.c.dom.collection.button.active !== undefined\n\t\t) {\n\t\t\tklass = this.c.dom.collection.button.active;\n\t\t}\n\n\t\tif (flag === undefined) {\n\t\t\treturn jqNode.hasClass(klass);\n\t\t}\n\n\t\tjqNode.toggleClass(klass, flag === undefined ? true : flag);\n\n\t\treturn this;\n\t},\n\n\t/**\n\t * Add a new button\n\t * @param {object} config Button configuration object, base string name or function\n\t * @param {int|string} [idx] Button index for where to insert the button\n\t * @param {boolean} [draw=true] Trigger a draw. Set a false when adding\n\t * lots of buttons, until the last button.\n\t * @return {Buttons} Self for chaining\n\t */\n\tadd: function (config, idx, draw) {\n\t\tvar buttons = this.s.buttons;\n\n\t\tif (typeof idx === 'string') {\n\t\t\tvar split = idx.split('-');\n\t\t\tvar base = this.s;\n\n\t\t\tfor (var i = 0, ien = split.length - 1; i < ien; i++) {\n\t\t\t\tbase = base.buttons[split[i] * 1];\n\t\t\t}\n\n\t\t\tbuttons = base.buttons;\n\t\t\tidx = split[split.length - 1] * 1;\n\t\t}\n\n\t\tthis._expandButton(\n\t\t\tbuttons,\n\t\t\tconfig,\n\t\t\tconfig !== undefined ? config.split : undefined,\n\t\t\t(config === undefined ||\n\t\t\t\tconfig.split === undefined ||\n\t\t\t\tconfig.split.length === 0) &&\n\t\t\t\tbase !== undefined,\n\t\t\tfalse,\n\t\t\tidx\n\t\t);\n\n\t\tif (draw === undefined || draw === true) {\n\t\t\tthis._draw();\n\t\t}\n\n\t\treturn this;\n\t},\n\n\t/**\n\t * Clear buttons from a collection and then insert new buttons\n\t */\n\tcollectionRebuild: function (node, newButtons) {\n\t\tvar button = this._nodeToButton(node);\n\n\t\tif (newButtons !== undefined) {\n\t\t\tvar i;\n\t\t\t// Need to reverse the array\n\t\t\tfor (i = button.buttons.length - 1; i >= 0; i--) {\n\t\t\t\tthis.remove(button.buttons[i].node);\n\t\t\t}\n\n\t\t\t// If the collection has prefix and / or postfix buttons we need to add them in\n\t\t\tif (button.conf.prefixButtons) {\n\t\t\t\tnewButtons.unshift.apply(newButtons, button.conf.prefixButtons);\n\t\t\t}\n\n\t\t\tif (button.conf.postfixButtons) {\n\t\t\t\tnewButtons.push.apply(newButtons, button.conf.postfixButtons);\n\t\t\t}\n\n\t\t\tfor (i = 0; i < newButtons.length; i++) {\n\t\t\t\tvar newBtn = newButtons[i];\n\n\t\t\t\tthis._expandButton(\n\t\t\t\t\tbutton.buttons,\n\t\t\t\t\tnewBtn,\n\t\t\t\t\tnewBtn !== undefined &&\n\t\t\t\t\t\tnewBtn.config !== undefined &&\n\t\t\t\t\t\tnewBtn.config.split !== undefined,\n\t\t\t\t\ttrue,\n\t\t\t\t\tnewBtn.parentConf !== undefined &&\n\t\t\t\t\t\tnewBtn.parentConf.split !== undefined,\n\t\t\t\t\tnull,\n\t\t\t\t\tnewBtn.parentConf\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tthis._draw(button.collection, button.buttons);\n\t},\n\n\t/**\n\t * Get the container node for the buttons\n\t * @return {jQuery} Buttons node\n\t */\n\tcontainer: function () {\n\t\treturn this.dom.container;\n\t},\n\n\t/**\n\t * Disable a button\n\t * @param {node} node Button node\n\t * @return {Buttons} Self for chaining\n\t */\n\tdisable: function (node) {\n\t\tvar button = this._nodeToButton(node);\n\n\t\t$(button.node)\n\t\t\t.addClass(this.c.dom.button.disabled)\n\t\t\t.prop('disabled', true);\n\n\t\treturn this;\n\t},\n\n\t/**\n\t * Destroy the instance, cleaning up event handlers and removing DOM\n\t * elements\n\t * @return {Buttons} Self for chaining\n\t */\n\tdestroy: function () {\n\t\t// Key event listener\n\t\t$('body').off('keyup.' + this.s.namespace);\n\n\t\t// Individual button destroy (so they can remove their own events if\n\t\t// needed). Take a copy as the array is modified by `remove`\n\t\tvar buttons = this.s.buttons.slice();\n\t\tvar i, ien;\n\n\t\tfor (i = 0, ien = buttons.length; i < ien; i++) {\n\t\t\tthis.remove(buttons[i].node);\n\t\t}\n\n\t\t// Container\n\t\tthis.dom.container.remove();\n\n\t\t// Remove from the settings object collection\n\t\tvar buttonInsts = this.s.dt.settings()[0];\n\n\t\tfor (i = 0, ien = buttonInsts.length; i < ien; i++) {\n\t\t\tif (buttonInsts.inst === this) {\n\t\t\t\tbuttonInsts.splice(i, 1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\t/**\n\t * Enable / disable a button\n\t * @param {node} node Button node\n\t * @param {boolean} [flag=true] Enable / disable flag\n\t * @return {Buttons} Self for chaining\n\t */\n\tenable: function (node, flag) {\n\t\tif (flag === false) {\n\t\t\treturn this.disable(node);\n\t\t}\n\n\t\tvar button = this._nodeToButton(node);\n\t\t$(button.node)\n\t\t\t.removeClass(this.c.dom.button.disabled)\n\t\t\t.prop('disabled', false);\n\n\t\treturn this;\n\t},\n\n\t/**\n\t * Get a button's index\n\t *\n\t * This is internally recursive\n\t * @param {element} node Button to get the index of\n\t * @return {string} Button index\n\t */\n\tindex: function (node, nested, buttons) {\n\t\tif (!nested) {\n\t\t\tnested = '';\n\t\t\tbuttons = this.s.buttons;\n\t\t}\n\n\t\tfor (var i = 0, ien = buttons.length; i < ien; i++) {\n\t\t\tvar inner = buttons[i].buttons;\n\n\t\t\tif (buttons[i].node === node) {\n\t\t\t\treturn nested + i;\n\t\t\t}\n\n\t\t\tif (inner && inner.length) {\n\t\t\t\tvar match = this.index(node, i + '-', inner);\n\n\t\t\t\tif (match !== null) {\n\t\t\t\t\treturn match;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t},\n\n\t/**\n\t * Get the instance name for the button set selector\n\t * @return {string} Instance name\n\t */\n\tname: function () {\n\t\treturn this.c.name;\n\t},\n\n\t/**\n\t * Get a button's node of the buttons container if no button is given\n\t * @param {node} [node] Button node\n\t * @return {jQuery} Button element, or container\n\t */\n\tnode: function (node) {\n\t\tif (!node) {\n\t\t\treturn this.dom.container;\n\t\t}\n\n\t\tvar button = this._nodeToButton(node);\n\t\treturn $(button.node);\n\t},\n\n\t/**\n\t * Set / get a processing class on the selected button\n\t * @param {element} node Triggering button node\n\t * @param {boolean} flag true to add, false to remove, undefined to get\n\t * @return {boolean|Buttons} Getter value or this if a setter.\n\t */\n\tprocessing: function (node, flag) {\n\t\tvar dt = this.s.dt;\n\t\tvar button = this._nodeToButton(node);\n\n\t\tif (flag === undefined) {\n\t\t\treturn $(button.node).hasClass('processing');\n\t\t}\n\n\t\t$(button.node).toggleClass('processing', flag);\n\n\t\t$(dt.table().node()).triggerHandler('buttons-processing.dt', [\n\t\t\tflag,\n\t\t\tdt.button(node),\n\t\t\tdt,\n\t\t\t$(node),\n\t\t\tbutton.conf\n\t\t]);\n\n\t\treturn this;\n\t},\n\n\t/**\n\t * Remove a button.\n\t * @param {node} node Button node\n\t * @return {Buttons} Self for chaining\n\t */\n\tremove: function (node) {\n\t\tvar button = this._nodeToButton(node);\n\t\tvar host = this._nodeToHost(node);\n\t\tvar dt = this.s.dt;\n\n\t\t// Remove any child buttons first\n\t\tif (button.buttons.length) {\n\t\t\tfor (var i = button.buttons.length - 1; i >= 0; i--) {\n\t\t\t\tthis.remove(button.buttons[i].node);\n\t\t\t}\n\t\t}\n\n\t\tbutton.conf.destroying = true;\n\n\t\t// Allow the button to remove event handlers, etc\n\t\tif (button.conf.destroy) {\n\t\t\tbutton.conf.destroy.call(dt.button(node), dt, $(node), button.conf);\n\t\t}\n\n\t\tthis._removeKey(button.conf);\n\n\t\t$(button.node).remove();\n\n\t\tvar idx = $.inArray(button, host);\n\t\thost.splice(idx, 1);\n\n\t\treturn this;\n\t},\n\n\t/**\n\t * Get the text for a button\n\t * @param {int|string} node Button index\n\t * @return {string} Button text\n\t */ /**\n\t * Set the text for a button\n\t * @param {int|string|function} node Button index\n\t * @param {string} label Text\n\t * @return {Buttons} Self for chaining\n\t */\n\ttext: function (node, label) {\n\t\tvar button = this._nodeToButton(node);\n\t\tvar textNode = button.textNode;\n\t\tvar dt = this.s.dt;\n\t\tvar jqNode = $(button.node);\n\t\tvar text = function (opt) {\n\t\t\treturn typeof opt === 'function'\n\t\t\t\t? opt(dt, jqNode, button.conf)\n\t\t\t\t: opt;\n\t\t};\n\n\t\tif (label === undefined) {\n\t\t\treturn text(button.conf.text);\n\t\t}\n\n\t\tbutton.conf.text = label;\n\t\ttextNode.html(text(label));\n\n\t\treturn this;\n\t},\n\n\t/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\t * Constructor\n\t */\n\n\t/**\n\t * Buttons constructor\n\t * @private\n\t */\n\t_constructor: function () {\n\t\tvar that = this;\n\t\tvar dt = this.s.dt;\n\t\tvar dtSettings = dt.settings()[0];\n\t\tvar buttons = this.c.buttons;\n\n\t\tif (!dtSettings._buttons) {\n\t\t\tdtSettings._buttons = [];\n\t\t}\n\n\t\tdtSettings._buttons.push({\n\t\t\tinst: this,\n\t\t\tname: this.c.name\n\t\t});\n\n\t\tfor (var i = 0, ien = buttons.length; i < ien; i++) {\n\t\t\tthis.add(buttons[i]);\n\t\t}\n\n\t\tdt.on('destroy', function (e, settings) {\n\t\t\tif (settings === dtSettings) {\n\t\t\t\tthat.destroy();\n\t\t\t}\n\t\t});\n\n\t\t// Global key event binding to listen for button keys\n\t\t$('body').on('keyup.' + this.s.namespace, function (e) {\n\t\t\tif (\n\t\t\t\t!document.activeElement ||\n\t\t\t\tdocument.activeElement === document.body\n\t\t\t) {\n\t\t\t\t// SUse a string of characters for fast lookup of if we need to\n\t\t\t\t// handle this\n\t\t\t\tvar character = String.fromCharCode(e.keyCode).toLowerCase();\n\n\t\t\t\tif (that.s.listenKeys.toLowerCase().indexOf(character) !== -1) {\n\t\t\t\t\tthat._keypress(character, e);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n\n\t/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\t * Private methods\n\t */\n\n\t/**\n\t * Add a new button to the key press listener\n\t * @param {object} conf Resolved button configuration object\n\t * @private\n\t */\n\t_addKey: function (conf) {\n\t\tif (conf.key) {\n\t\t\tthis.s.listenKeys += $.isPlainObject(conf.key)\n\t\t\t\t? conf.key.key\n\t\t\t\t: conf.key;\n\t\t}\n\t},\n\n\t/**\n\t * Insert the buttons into the container. Call without parameters!\n\t * @param {node} [container] Recursive only - Insert point\n\t * @param {array} [buttons] Recursive only - Buttons array\n\t * @private\n\t */\n\t_draw: function (container, buttons) {\n\t\tif (!container) {\n\t\t\tcontainer = this.dom.container;\n\t\t\tbuttons = this.s.buttons;\n\t\t}\n\n\t\tcontainer.children().detach();\n\n\t\tfor (var i = 0, ien = buttons.length; i < ien; i++) {\n\t\t\tcontainer.append(buttons[i].inserter);\n\t\t\tcontainer.append(' ');\n\n\t\t\tif (buttons[i].buttons && buttons[i].buttons.length) {\n\t\t\t\tthis._draw(buttons[i].collection, buttons[i].buttons);\n\t\t\t}\n\t\t}\n\t},\n\n\t/**\n\t * Create buttons from an array of buttons\n\t * @param {array} attachTo Buttons array to attach to\n\t * @param {object} button Button definition\n\t * @param {boolean} inCollection true if the button is in a collection\n\t * @private\n\t */\n\t_expandButton: function (\n\t\tattachTo,\n\t\tbutton,\n\t\tsplit,\n\t\tinCollection,\n\t\tinSplit,\n\t\tattachPoint,\n\t\tparentConf\n\t) {\n\t\tvar dt = this.s.dt;\n\t\tvar isSplit = false;\n\t\tvar domCollection = this.c.dom.collection;\n\t\tvar buttons = !Array.isArray(button) ? [button] : button;\n\n\t\tif (button === undefined) {\n\t\t\tbuttons = !Array.isArray(split) ? [split] : split;\n\t\t}\n\n\t\tfor (var i = 0, ien = buttons.length; i < ien; i++) {\n\t\t\tvar conf = this._resolveExtends(buttons[i]);\n\n\t\t\tif (!conf) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tisSplit = conf.config && conf.config.split ? true : false;\n\n\t\t\t// If the configuration is an array, then expand the buttons at this\n\t\t\t// point\n\t\t\tif (Array.isArray(conf)) {\n\t\t\t\tthis._expandButton(\n\t\t\t\t\tattachTo,\n\t\t\t\t\tconf,\n\t\t\t\t\tbuilt !== undefined && built.conf !== undefined\n\t\t\t\t\t\t? built.conf.split\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tinCollection,\n\t\t\t\t\tparentConf !== undefined && parentConf.split !== undefined,\n\t\t\t\t\tattachPoint,\n\t\t\t\t\tparentConf\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar built = this._buildButton(\n\t\t\t\tconf,\n\t\t\t\tinCollection,\n\t\t\t\tconf.split !== undefined ||\n\t\t\t\t\t(conf.config !== undefined &&\n\t\t\t\t\t\tconf.config.split !== undefined),\n\t\t\t\tinSplit\n\t\t\t);\n\t\t\tif (!built) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (attachPoint !== undefined && attachPoint !== null) {\n\t\t\t\tattachTo.splice(attachPoint, 0, built);\n\t\t\t\tattachPoint++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tattachTo.push(built);\n\t\t\t}\n\n\t\t\t// Create the dropdown for a collection\n\t\t\tif (built.conf.buttons) {\n\t\t\t\tbuilt.collection = $(\n\t\t\t\t\t'<' + domCollection.container.content.tag + '/>'\n\t\t\t\t);\n\t\t\t\tbuilt.conf._collection = built.collection;\n\n\t\t\t\t$(built.node).append(domCollection.action.dropHtml);\n\n\t\t\t\tthis._expandButton(\n\t\t\t\t\tbuilt.buttons,\n\t\t\t\t\tbuilt.conf.buttons,\n\t\t\t\t\tbuilt.conf.split,\n\t\t\t\t\t!isSplit,\n\t\t\t\t\tisSplit,\n\t\t\t\t\tattachPoint,\n\t\t\t\t\tbuilt.conf\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// And the split collection\n\t\t\tif (built.conf.split) {\n\t\t\t\tbuilt.collection = $('<' + domCollection.container.tag + '/>');\n\t\t\t\tbuilt.conf._collection = built.collection;\n\n\t\t\t\tfor (var j = 0; j < built.conf.split.length; j++) {\n\t\t\t\t\tvar item = built.conf.split[j];\n\n\t\t\t\t\tif (typeof item === 'object') {\n\t\t\t\t\t\titem.parent = parentConf;\n\n\t\t\t\t\t\tif (item.collectionLayout === undefined) {\n\t\t\t\t\t\t\titem.collectionLayout = built.conf.collectionLayout;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (item.dropup === undefined) {\n\t\t\t\t\t\t\titem.dropup = built.conf.dropup;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (item.fade === undefined) {\n\t\t\t\t\t\t\titem.fade = built.conf.fade;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis._expandButton(\n\t\t\t\t\tbuilt.buttons,\n\t\t\t\t\tbuilt.conf.buttons,\n\t\t\t\t\tbuilt.conf.split,\n\t\t\t\t\t!isSplit,\n\t\t\t\t\tisSplit,\n\t\t\t\t\tattachPoint,\n\t\t\t\t\tbuilt.conf\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tbuilt.conf.parent = parentConf;\n\n\t\t\t// init call is made here, rather than buildButton as it needs to\n\t\t\t// be selectable, and for that it needs to be in the buttons array\n\t\t\tif (conf.init) {\n\t\t\t\tconf.init.call(dt.button(built.node), dt, $(built.node), conf);\n\t\t\t}\n\t\t}\n\t},\n\n\t/**\n\t * Create an individual button\n\t * @param {object} config Resolved button configuration\n\t * @param {boolean} inCollection `true` if a collection button\n\t * @return {object} Completed button description object\n\t * @private\n\t */\n\t_buildButton: function (config, inCollection, isSplit, inSplit) {\n\t\tvar that = this;\n\t\tvar configDom = this.c.dom;\n\t\tvar textNode;\n\t\tvar dt = this.s.dt;\n\t\tvar text = function (opt) {\n\t\t\treturn typeof opt === 'function' ? opt(dt, button, config) : opt;\n\t\t};\n\n\t\t// Create an object that describes the button which can be in `dom.button`, or\n\t\t// `dom.collection.button` or `dom.split.button` or `dom.collection.split.button`!\n\t\t// Each should extend from `dom.button`.\n\t\tvar dom = $.extend(true, {}, configDom.button);\n\n\t\tif (inCollection && isSplit && configDom.collection.split) {\n\t\t\t$.extend(true, dom, configDom.collection.split.action);\n\t\t}\n\t\telse if (inSplit || inCollection) {\n\t\t\t$.extend(true, dom, configDom.collection.button);\n\t\t}\n\t\telse if (isSplit) {\n\t\t\t$.extend(true, dom, configDom.split.button);\n\t\t}\n\n\t\t// Spacers don't do much other than insert an element into the DOM\n\t\tif (config.spacer) {\n\t\t\tvar spacer = $('<' + dom.spacer.tag + '/>')\n\t\t\t\t.addClass(\n\t\t\t\t\t'dt-button-spacer ' +\n\t\t\t\t\t\tconfig.style +\n\t\t\t\t\t\t' ' +\n\t\t\t\t\t\tdom.spacer.className\n\t\t\t\t)\n\t\t\t\t.html(text(config.text));\n\n\t\t\treturn {\n\t\t\t\tconf: config,\n\t\t\t\tnode: spacer,\n\t\t\t\tinserter: spacer,\n\t\t\t\tbuttons: [],\n\t\t\t\tinCollection: inCollection,\n\t\t\t\tisSplit: isSplit,\n\t\t\t\tcollection: null,\n\t\t\t\ttextNode: spacer\n\t\t\t};\n\t\t}\n\n\t\t// Make sure that the button is available based on whatever requirements\n\t\t// it has. For example, PDF button require pdfmake\n\t\tif (\n\t\t\tconfig.available &&\n\t\t\t!config.available(dt, config) &&\n\t\t\t!config.html\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar button;\n\n\t\tif (!config.html) {\n\t\t\tvar run = function (e, dt, button, config, done) {\n\t\t\t\tconfig.action.call(dt.button(button), e, dt, button, config, done);\n\n\t\t\t\t$(dt.table().node()).triggerHandler('buttons-action.dt', [\n\t\t\t\t\tdt.button(button),\n\t\t\t\t\tdt,\n\t\t\t\t\tbutton,\n\t\t\t\t\tconfig\n\t\t\t\t]);\n\t\t\t};\n\n\t\t\tvar action = function(e, dt, button, config) {\n\t\t\t\tif (config.async) {\n\t\t\t\t\tthat.processing(button[0], true);\n\n\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\trun(e, dt, button, config, function () {\n\t\t\t\t\t\t\tthat.processing(button[0], false);\n\t\t\t\t\t\t});\n\t\t\t\t\t}, config.async);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\trun(e, dt, button, config, function () {});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar tag = config.tag || dom.tag;\n\t\t\tvar clickBlurs =\n\t\t\t\tconfig.clickBlurs === undefined ? true : config.clickBlurs;\n\n\t\t\tbutton = $('<' + tag + '/>')\n\t\t\t\t.addClass(dom.className)\n\t\t\t\t.attr('tabindex', this.s.dt.settings()[0].iTabIndex)\n\t\t\t\t.attr('aria-controls', this.s.dt.table().node().id)\n\t\t\t\t.on('click.dtb', function (e) {\n\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\tif (!button.hasClass(dom.disabled) && config.action) {\n\t\t\t\t\t\taction(e, dt, button, config);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (clickBlurs) {\n\t\t\t\t\t\tbutton.trigger('blur');\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.on('keypress.dtb', function (e) {\n\t\t\t\t\tif (e.keyCode === 13) {\n\t\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\t\tif (!button.hasClass(dom.disabled) && config.action) {\n\t\t\t\t\t\t\taction(e, dt, button, config);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t// Make `a` tags act like a link\n\t\t\tif (tag.toLowerCase() === 'a') {\n\t\t\t\tbutton.attr('href', '#');\n\t\t\t}\n\n\t\t\t// Button tags should have `type=button` so they don't have any default behaviour\n\t\t\tif (tag.toLowerCase() === 'button') {\n\t\t\t\tbutton.attr('type', 'button');\n\t\t\t}\n\n\t\t\tif (dom.liner.tag) {\n\t\t\t\tvar liner = $('<' + dom.liner.tag + '/>')\n\t\t\t\t\t.html(text(config.text))\n\t\t\t\t\t.addClass(dom.liner.className);\n\n\t\t\t\tif (dom.liner.tag.toLowerCase() === 'a') {\n\t\t\t\t\tliner.attr('href', '#');\n\t\t\t\t}\n\n\t\t\t\tbutton.append(liner);\n\t\t\t\ttextNode = liner;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tbutton.html(text(config.text));\n\t\t\t\ttextNode = button;\n\t\t\t}\n\n\t\t\tif (config.enabled === false) {\n\t\t\t\tbutton.addClass(dom.disabled);\n\t\t\t}\n\n\t\t\tif (config.className) {\n\t\t\t\tbutton.addClass(config.className);\n\t\t\t}\n\n\t\t\tif (config.titleAttr) {\n\t\t\t\tbutton.attr('title', text(config.titleAttr));\n\t\t\t}\n\n\t\t\tif (config.attr) {\n\t\t\t\tbutton.attr(config.attr);\n\t\t\t}\n\n\t\t\tif (!config.namespace) {\n\t\t\t\tconfig.namespace = '.dt-button-' + _buttonCounter++;\n\t\t\t}\n\n\t\t\tif (config.config !== undefined && config.config.split) {\n\t\t\t\tconfig.split = config.config.split;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tbutton = $(config.html);\n\t\t}\n\n\t\tvar buttonContainer = this.c.dom.buttonContainer;\n\t\tvar inserter;\n\t\tif (buttonContainer && buttonContainer.tag) {\n\t\t\tinserter = $('<' + buttonContainer.tag + '/>')\n\t\t\t\t.addClass(buttonContainer.className)\n\t\t\t\t.append(button);\n\t\t}\n\t\telse {\n\t\t\tinserter = button;\n\t\t}\n\n\t\tthis._addKey(config);\n\n\t\t// Style integration callback for DOM manipulation\n\t\t// Note that this is _not_ documented. It is currently\n\t\t// for style integration only\n\t\tif (this.c.buttonCreated) {\n\t\t\tinserter = this.c.buttonCreated(config, inserter);\n\t\t}\n\n\t\tvar splitDiv;\n\n\t\tif (isSplit) {\n\t\t\tvar dropdownConf = inCollection\n\t\t\t\t? $.extend(true, this.c.dom.split, this.c.dom.collection.split)\n\t\t\t\t: this.c.dom.split;\n\t\t\tvar wrapperConf = dropdownConf.wrapper;\n\n\t\t\tsplitDiv = $('<' + wrapperConf.tag + '/>')\n\t\t\t\t.addClass(wrapperConf.className)\n\t\t\t\t.append(button);\n\n\t\t\tvar dropButtonConfig = $.extend(config, {\n\t\t\t\talign: dropdownConf.dropdown.align,\n\t\t\t\tattr: {\n\t\t\t\t\t'aria-haspopup': 'dialog',\n\t\t\t\t\t'aria-expanded': false\n\t\t\t\t},\n\t\t\t\tclassName: dropdownConf.dropdown.className,\n\t\t\t\tcloseButton: false,\n\t\t\t\tsplitAlignClass: dropdownConf.dropdown.splitAlignClass,\n\t\t\t\ttext: dropdownConf.dropdown.text\n\t\t\t});\n\n\t\t\tthis._addKey(dropButtonConfig);\n\n\t\t\tvar splitAction = function (e, dt, button, config) {\n\t\t\t\t_dtButtons.split.action.call(\n\t\t\t\t\tdt.button(splitDiv),\n\t\t\t\t\te,\n\t\t\t\t\tdt,\n\t\t\t\t\tbutton,\n\t\t\t\t\tconfig\n\t\t\t\t);\n\n\t\t\t\t$(dt.table().node()).triggerHandler('buttons-action.dt', [\n\t\t\t\t\tdt.button(button),\n\t\t\t\t\tdt,\n\t\t\t\t\tbutton,\n\t\t\t\t\tconfig\n\t\t\t\t]);\n\t\t\t\tbutton.attr('aria-expanded', true);\n\t\t\t};\n\n\t\t\tvar dropButton = $(\n\t\t\t\t'
'\n\t\t\t)\n\t\t\t\t.html(dropdownConf.dropdown.dropHtml)\n\t\t\t\t.on('click.dtb', function (e) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\n\t\t\t\t\tif (!dropButton.hasClass(dom.disabled)) {\n\t\t\t\t\t\tsplitAction(e, dt, dropButton, dropButtonConfig);\n\t\t\t\t\t}\n\t\t\t\t\tif (clickBlurs) {\n\t\t\t\t\t\tdropButton.trigger('blur');\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.on('keypress.dtb', function (e) {\n\t\t\t\t\tif (e.keyCode === 13) {\n\t\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\t\tif (!dropButton.hasClass(dom.disabled)) {\n\t\t\t\t\t\t\tsplitAction(e, dt, dropButton, dropButtonConfig);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\tif (config.split.length === 0) {\n\t\t\t\tdropButton.addClass('dtb-hide-drop');\n\t\t\t}\n\n\t\t\tsplitDiv.append(dropButton).attr(dropButtonConfig.attr);\n\t\t}\n\n\t\treturn {\n\t\t\tconf: config,\n\t\t\tnode: isSplit ? splitDiv.get(0) : button.get(0),\n\t\t\tinserter: isSplit ? splitDiv : inserter,\n\t\t\tbuttons: [],\n\t\t\tinCollection: inCollection,\n\t\t\tisSplit: isSplit,\n\t\t\tinSplit: inSplit,\n\t\t\tcollection: null,\n\t\t\ttextNode: textNode\n\t\t};\n\t},\n\n\t/**\n\t * Get the button object from a node (recursive)\n\t * @param {node} node Button node\n\t * @param {array} [buttons] Button array, uses base if not defined\n\t * @return {object} Button object\n\t * @private\n\t */\n\t_nodeToButton: function (node, buttons) {\n\t\tif (!buttons) {\n\t\t\tbuttons = this.s.buttons;\n\t\t}\n\n\t\tfor (var i = 0, ien = buttons.length; i < ien; i++) {\n\t\t\tif (buttons[i].node === node) {\n\t\t\t\treturn buttons[i];\n\t\t\t}\n\n\t\t\tif (buttons[i].buttons.length) {\n\t\t\t\tvar ret = this._nodeToButton(node, buttons[i].buttons);\n\n\t\t\t\tif (ret) {\n\t\t\t\t\treturn ret;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\t/**\n\t * Get container array for a button from a button node (recursive)\n\t * @param {node} node Button node\n\t * @param {array} [buttons] Button array, uses base if not defined\n\t * @return {array} Button's host array\n\t * @private\n\t */\n\t_nodeToHost: function (node, buttons) {\n\t\tif (!buttons) {\n\t\t\tbuttons = this.s.buttons;\n\t\t}\n\n\t\tfor (var i = 0, ien = buttons.length; i < ien; i++) {\n\t\t\tif (buttons[i].node === node) {\n\t\t\t\treturn buttons;\n\t\t\t}\n\n\t\t\tif (buttons[i].buttons.length) {\n\t\t\t\tvar ret = this._nodeToHost(node, buttons[i].buttons);\n\n\t\t\t\tif (ret) {\n\t\t\t\t\treturn ret;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\t/**\n\t * Handle a key press - determine if any button's key configured matches\n\t * what was typed and trigger the action if so.\n\t * @param {string} character The character pressed\n\t * @param {object} e Key event that triggered this call\n\t * @private\n\t */\n\t_keypress: function (character, e) {\n\t\t// Check if this button press already activated on another instance of Buttons\n\t\tif (e._buttonsHandled) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar run = function (conf, node) {\n\t\t\tif (!conf.key) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (conf.key === character) {\n\t\t\t\te._buttonsHandled = true;\n\t\t\t\t$(node).click();\n\t\t\t}\n\t\t\telse if ($.isPlainObject(conf.key)) {\n\t\t\t\tif (conf.key.key !== character) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (conf.key.shiftKey && !e.shiftKey) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (conf.key.altKey && !e.altKey) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (conf.key.ctrlKey && !e.ctrlKey) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (conf.key.metaKey && !e.metaKey) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Made it this far - it is good\n\t\t\t\te._buttonsHandled = true;\n\t\t\t\t$(node).click();\n\t\t\t}\n\t\t};\n\n\t\tvar recurse = function (a) {\n\t\t\tfor (var i = 0, ien = a.length; i < ien; i++) {\n\t\t\t\trun(a[i].conf, a[i].node);\n\n\t\t\t\tif (a[i].buttons.length) {\n\t\t\t\t\trecurse(a[i].buttons);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\trecurse(this.s.buttons);\n\t},\n\n\t/**\n\t * Remove a key from the key listener for this instance (to be used when a\n\t * button is removed)\n\t * @param {object} conf Button configuration\n\t * @private\n\t */\n\t_removeKey: function (conf) {\n\t\tif (conf.key) {\n\t\t\tvar character = $.isPlainObject(conf.key) ? conf.key.key : conf.key;\n\n\t\t\t// Remove only one character, as multiple buttons could have the\n\t\t\t// same listening key\n\t\t\tvar a = this.s.listenKeys.split('');\n\t\t\tvar idx = $.inArray(character, a);\n\t\t\ta.splice(idx, 1);\n\t\t\tthis.s.listenKeys = a.join('');\n\t\t}\n\t},\n\n\t/**\n\t * Resolve a button configuration\n\t * @param {string|function|object} conf Button config to resolve\n\t * @return {object} Button configuration\n\t * @private\n\t */\n\t_resolveExtends: function (conf) {\n\t\tvar that = this;\n\t\tvar dt = this.s.dt;\n\t\tvar i, ien;\n\t\tvar toConfObject = function (base) {\n\t\t\tvar loop = 0;\n\n\t\t\t// Loop until we have resolved to a button configuration, or an\n\t\t\t// array of button configurations (which will be iterated\n\t\t\t// separately)\n\t\t\twhile (!$.isPlainObject(base) && !Array.isArray(base)) {\n\t\t\t\tif (base === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (typeof base === 'function') {\n\t\t\t\t\tbase = base.call(that, dt, conf);\n\n\t\t\t\t\tif (!base) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (typeof base === 'string') {\n\t\t\t\t\tif (!_dtButtons[base]) {\n\t\t\t\t\t\treturn { html: base };\n\t\t\t\t\t}\n\n\t\t\t\t\tbase = _dtButtons[base];\n\t\t\t\t}\n\n\t\t\t\tloop++;\n\t\t\t\tif (loop > 30) {\n\t\t\t\t\t// Protect against misconfiguration killing the browser\n\t\t\t\t\tthrow 'Buttons: Too many iterations';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn Array.isArray(base) ? base : $.extend({}, base);\n\t\t};\n\n\t\tconf = toConfObject(conf);\n\n\t\twhile (conf && conf.extend) {\n\t\t\t// Use `toConfObject` in case the button definition being extended\n\t\t\t// is itself a string or a function\n\t\t\tif (!_dtButtons[conf.extend]) {\n\t\t\t\tthrow 'Cannot extend unknown button type: ' + conf.extend;\n\t\t\t}\n\n\t\t\tvar objArray = toConfObject(_dtButtons[conf.extend]);\n\t\t\tif (Array.isArray(objArray)) {\n\t\t\t\treturn objArray;\n\t\t\t}\n\t\t\telse if (!objArray) {\n\t\t\t\t// This is a little brutal as it might be possible to have a\n\t\t\t\t// valid button without the extend, but if there is no extend\n\t\t\t\t// then the host button would be acting in an undefined state\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Stash the current class name\n\t\t\tvar originalClassName = objArray.className;\n\n\t\t\tif (conf.config !== undefined && objArray.config !== undefined) {\n\t\t\t\tconf.config = $.extend({}, objArray.config, conf.config);\n\t\t\t}\n\n\t\t\tconf = $.extend({}, objArray, conf);\n\n\t\t\t// The extend will have overwritten the original class name if the\n\t\t\t// `conf` object also assigned a class, but we want to concatenate\n\t\t\t// them so they are list that is combined from all extended buttons\n\t\t\tif (originalClassName && conf.className !== originalClassName) {\n\t\t\t\tconf.className = originalClassName + ' ' + conf.className;\n\t\t\t}\n\n\t\t\t// Although we want the `conf` object to overwrite almost all of\n\t\t\t// the properties of the object being extended, the `extend`\n\t\t\t// property should come from the object being extended\n\t\t\tconf.extend = objArray.extend;\n\t\t}\n\n\t\t// Buttons to be added to a collection -gives the ability to define\n\t\t// if buttons should be added to the start or end of a collection\n\t\tvar postfixButtons = conf.postfixButtons;\n\t\tif (postfixButtons) {\n\t\t\tif (!conf.buttons) {\n\t\t\t\tconf.buttons = [];\n\t\t\t}\n\n\t\t\tfor (i = 0, ien = postfixButtons.length; i < ien; i++) {\n\t\t\t\tconf.buttons.push(postfixButtons[i]);\n\t\t\t}\n\t\t}\n\n\t\tvar prefixButtons = conf.prefixButtons;\n\t\tif (prefixButtons) {\n\t\t\tif (!conf.buttons) {\n\t\t\t\tconf.buttons = [];\n\t\t\t}\n\n\t\t\tfor (i = 0, ien = prefixButtons.length; i < ien; i++) {\n\t\t\t\tconf.buttons.splice(i, 0, prefixButtons[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn conf;\n\t},\n\n\t/**\n\t * Display (and replace if there is an existing one) a popover attached to a button\n\t * @param {string|node} content Content to show\n\t * @param {DataTable.Api} hostButton DT API instance of the button\n\t * @param {object} inOpts Options (see object below for all options)\n\t */\n\t_popover: function (content, hostButton, inOpts) {\n\t\tvar dt = hostButton;\n\t\tvar c = this.c;\n\t\tvar closed = false;\n\t\tvar options = $.extend(\n\t\t\t{\n\t\t\t\talign: 'button-left', // button-right, dt-container, split-left, split-right\n\t\t\t\tautoClose: false,\n\t\t\t\tbackground: true,\n\t\t\t\tbackgroundClassName: 'dt-button-background',\n\t\t\t\tcloseButton: true,\n\t\t\t\tcontainerClassName: c.dom.collection.container.className,\n\t\t\t\tcontentClassName: c.dom.collection.container.content.className,\n\t\t\t\tcollectionLayout: '',\n\t\t\t\tcollectionTitle: '',\n\t\t\t\tdropup: false,\n\t\t\t\tfade: 400,\n\t\t\t\tpopoverTitle: '',\n\t\t\t\trightAlignClassName: 'dt-button-right',\n\t\t\t\ttag: c.dom.collection.container.tag\n\t\t\t},\n\t\t\tinOpts\n\t\t);\n\n\t\tvar containerSelector =\n\t\t\toptions.tag + '.' + options.containerClassName.replace(/ /g, '.');\n\t\tvar hostNode = hostButton.node();\n\n\t\tvar close = function () {\n\t\t\tclosed = true;\n\n\t\t\t_fadeOut($(containerSelector), options.fade, function () {\n\t\t\t\t$(this).detach();\n\t\t\t});\n\n\t\t\t$(\n\t\t\t\tdt\n\t\t\t\t\t.buttons('[aria-haspopup=\"dialog\"][aria-expanded=\"true\"]')\n\t\t\t\t\t.nodes()\n\t\t\t).attr('aria-expanded', 'false');\n\n\t\t\t$('div.dt-button-background').off('click.dtb-collection');\n\t\t\tButtons.background(\n\t\t\t\tfalse,\n\t\t\t\toptions.backgroundClassName,\n\t\t\t\toptions.fade,\n\t\t\t\thostNode\n\t\t\t);\n\n\t\t\t$(window).off('resize.resize.dtb-collection');\n\t\t\t$('body').off('.dtb-collection');\n\t\t\tdt.off('buttons-action.b-internal');\n\t\t\tdt.off('destroy');\n\t\t};\n\n\t\tif (content === false) {\n\t\t\tclose();\n\t\t\treturn;\n\t\t}\n\n\t\tvar existingExpanded = $(\n\t\t\tdt.buttons('[aria-haspopup=\"dialog\"][aria-expanded=\"true\"]').nodes()\n\t\t);\n\t\tif (existingExpanded.length) {\n\t\t\t// Reuse the current position if the button that was triggered is inside an existing collection\n\t\t\tif (hostNode.closest(containerSelector).length) {\n\t\t\t\thostNode = existingExpanded.eq(0);\n\t\t\t}\n\n\t\t\tclose();\n\t\t}\n\n\t\t// Try to be smart about the layout\n\t\tvar cnt = $('.dt-button', content).length;\n\t\tvar mod = '';\n\n\t\tif (cnt === 3) {\n\t\t\tmod = 'dtb-b3';\n\t\t}\n\t\telse if (cnt === 2) {\n\t\t\tmod = 'dtb-b2';\n\t\t}\n\t\telse if (cnt === 1) {\n\t\t\tmod = 'dtb-b1';\n\t\t}\n\n\t\tvar display = $('<' + options.tag + '/>')\n\t\t\t.addClass(options.containerClassName)\n\t\t\t.addClass(options.collectionLayout)\n\t\t\t.addClass(options.splitAlignClass)\n\t\t\t.addClass(mod)\n\t\t\t.css('display', 'none')\n\t\t\t.attr({\n\t\t\t\t'aria-modal': true,\n\t\t\t\trole: 'dialog'\n\t\t\t});\n\n\t\tcontent = $(content)\n\t\t\t.addClass(options.contentClassName)\n\t\t\t.attr('role', 'menu')\n\t\t\t.appendTo(display);\n\n\t\thostNode.attr('aria-expanded', 'true');\n\n\t\tif (hostNode.parents('body')[0] !== document.body) {\n\t\t\thostNode = document.body.lastChild;\n\t\t}\n\n\t\tif (options.popoverTitle) {\n\t\t\tdisplay.prepend(\n\t\t\t\t'
' +\n\t\t\t\t\toptions.popoverTitle +\n\t\t\t\t\t'
'\n\t\t\t);\n\t\t}\n\t\telse if (options.collectionTitle) {\n\t\t\tdisplay.prepend(\n\t\t\t\t'
' +\n\t\t\t\t\toptions.collectionTitle +\n\t\t\t\t\t'
'\n\t\t\t);\n\t\t}\n\n\t\tif (options.closeButton) {\n\t\t\tdisplay\n\t\t\t\t.prepend('
×
')\n\t\t\t\t.addClass('dtb-collection-closeable');\n\t\t}\n\n\t\t_fadeIn(display.insertAfter(hostNode), options.fade);\n\n\t\tvar tableContainer = $(hostButton.table().container());\n\t\tvar position = display.css('position');\n\n\t\tif (options.span === 'container' || options.align === 'dt-container') {\n\t\t\thostNode = hostNode.parent();\n\t\t\tdisplay.css('width', tableContainer.width());\n\t\t}\n\n\t\t// Align the popover relative to the DataTables container\n\t\t// Useful for wide popovers such as SearchPanes\n\t\tif (position === 'absolute') {\n\t\t\t// Align relative to the host button\n\t\t\tvar offsetParent = $(hostNode[0].offsetParent);\n\t\t\tvar buttonPosition = hostNode.position();\n\t\t\tvar buttonOffset = hostNode.offset();\n\t\t\tvar tableSizes = offsetParent.offset();\n\t\t\tvar containerPosition = offsetParent.position();\n\t\t\tvar computed = window.getComputedStyle(offsetParent[0]);\n\n\t\t\ttableSizes.height = offsetParent.outerHeight();\n\t\t\ttableSizes.width =\n\t\t\t\toffsetParent.width() + parseFloat(computed.paddingLeft);\n\t\t\ttableSizes.right = tableSizes.left + tableSizes.width;\n\t\t\ttableSizes.bottom = tableSizes.top + tableSizes.height;\n\n\t\t\t// Set the initial position so we can read height / width\n\t\t\tvar top = buttonPosition.top + hostNode.outerHeight();\n\t\t\tvar left = buttonPosition.left;\n\n\t\t\tdisplay.css({\n\t\t\t\ttop: top,\n\t\t\t\tleft: left\n\t\t\t});\n\n\t\t\t// Get the popover position\n\t\t\tcomputed = window.getComputedStyle(display[0]);\n\t\t\tvar popoverSizes = display.offset();\n\n\t\t\tpopoverSizes.height = display.outerHeight();\n\t\t\tpopoverSizes.width = display.outerWidth();\n\t\t\tpopoverSizes.right = popoverSizes.left + popoverSizes.width;\n\t\t\tpopoverSizes.bottom = popoverSizes.top + popoverSizes.height;\n\t\t\tpopoverSizes.marginTop = parseFloat(computed.marginTop);\n\t\t\tpopoverSizes.marginBottom = parseFloat(computed.marginBottom);\n\n\t\t\t// First position per the class requirements - pop up and right align\n\t\t\tif (options.dropup) {\n\t\t\t\ttop =\n\t\t\t\t\tbuttonPosition.top -\n\t\t\t\t\tpopoverSizes.height -\n\t\t\t\t\tpopoverSizes.marginTop -\n\t\t\t\t\tpopoverSizes.marginBottom;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\toptions.align === 'button-right' ||\n\t\t\t\tdisplay.hasClass(options.rightAlignClassName)\n\t\t\t) {\n\t\t\t\tleft =\n\t\t\t\t\tbuttonPosition.left -\n\t\t\t\t\tpopoverSizes.width +\n\t\t\t\t\thostNode.outerWidth();\n\t\t\t}\n\n\t\t\t// Container alignment - make sure it doesn't overflow the table container\n\t\t\tif (\n\t\t\t\toptions.align === 'dt-container' ||\n\t\t\t\toptions.align === 'container'\n\t\t\t) {\n\t\t\t\tif (left < buttonPosition.left) {\n\t\t\t\t\tleft = -buttonPosition.left;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Window adjustment\n\t\t\tif (\n\t\t\t\tcontainerPosition.left + left + popoverSizes.width >\n\t\t\t\t$(window).width()\n\t\t\t) {\n\t\t\t\t// Overflowing the document to the right\n\t\t\t\tleft =\n\t\t\t\t\t$(window).width() -\n\t\t\t\t\tpopoverSizes.width -\n\t\t\t\t\tcontainerPosition.left;\n\t\t\t}\n\n\t\t\tif (buttonOffset.left + left < 0) {\n\t\t\t\t// Off to the left of the document\n\t\t\t\tleft = -buttonOffset.left;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tcontainerPosition.top + top + popoverSizes.height >\n\t\t\t\t$(window).height() + $(window).scrollTop()\n\t\t\t) {\n\t\t\t\t// Pop up if otherwise we'd need the user to scroll down\n\t\t\t\ttop =\n\t\t\t\t\tbuttonPosition.top -\n\t\t\t\t\tpopoverSizes.height -\n\t\t\t\t\tpopoverSizes.marginTop -\n\t\t\t\t\tpopoverSizes.marginBottom;\n\t\t\t}\n\n\t\t\tif (containerPosition.top + top < $(window).scrollTop()) {\n\t\t\t\t// Correction for when the top is beyond the top of the page\n\t\t\t\ttop = buttonPosition.top + hostNode.outerHeight();\n\t\t\t}\n\n\t\t\t// Calculations all done - now set it\n\t\t\tdisplay.css({\n\t\t\t\ttop: top,\n\t\t\t\tleft: left\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\t// Fix position - centre on screen\n\t\t\tvar place = function () {\n\t\t\t\tvar half = $(window).height() / 2;\n\n\t\t\t\tvar top = display.height() / 2;\n\t\t\t\tif (top > half) {\n\t\t\t\t\ttop = half;\n\t\t\t\t}\n\n\t\t\t\tdisplay.css('marginTop', top * -1);\n\t\t\t};\n\n\t\t\tplace();\n\n\t\t\t$(window).on('resize.dtb-collection', function () {\n\t\t\t\tplace();\n\t\t\t});\n\t\t}\n\n\t\tif (options.background) {\n\t\t\tButtons.background(\n\t\t\t\ttrue,\n\t\t\t\toptions.backgroundClassName,\n\t\t\t\toptions.fade,\n\t\t\t\toptions.backgroundHost || hostNode\n\t\t\t);\n\t\t}\n\n\t\t// This is bonkers, but if we don't have a click listener on the\n\t\t// background element, iOS Safari will ignore the body click\n\t\t// listener below. An empty function here is all that is\n\t\t// required to make it work...\n\t\t$('div.dt-button-background').on(\n\t\t\t'click.dtb-collection',\n\t\t\tfunction () {}\n\t\t);\n\n\t\tif (options.autoClose) {\n\t\t\tsetTimeout(function () {\n\t\t\t\tdt.on('buttons-action.b-internal', function (e, btn, dt, node) {\n\t\t\t\t\tif (node[0] === hostNode[0]) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tclose();\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t}\n\n\t\t$(display).trigger('buttons-popover.dt');\n\n\t\tdt.on('destroy', close);\n\n\t\tsetTimeout(function () {\n\t\t\tclosed = false;\n\t\t\t$('body')\n\t\t\t\t.on('click.dtb-collection', function (e) {\n\t\t\t\t\tif (closed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// andSelf is deprecated in jQ1.8, but we want 1.7 compat\n\t\t\t\t\tvar back = $.fn.addBack ? 'addBack' : 'andSelf';\n\t\t\t\t\tvar parent = $(e.target).parent()[0];\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t(!$(e.target).parents()[back]().filter(content)\n\t\t\t\t\t\t\t.length &&\n\t\t\t\t\t\t\t!$(parent).hasClass('dt-buttons')) ||\n\t\t\t\t\t\t$(e.target).hasClass('dt-button-background')\n\t\t\t\t\t) {\n\t\t\t\t\t\tclose();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.on('keyup.dtb-collection', function (e) {\n\t\t\t\t\tif (e.keyCode === 27) {\n\t\t\t\t\t\tclose();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.on('keydown.dtb-collection', function (e) {\n\t\t\t\t\t// Focus trap for tab key\n\t\t\t\t\tvar elements = $('a, button', content);\n\t\t\t\t\tvar active = document.activeElement;\n\n\t\t\t\t\tif (e.keyCode !== 9) {\n\t\t\t\t\t\t// tab\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (elements.index(active) === -1) {\n\t\t\t\t\t\t// If current focus is not inside the popover\n\t\t\t\t\t\telements.first().focus();\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t\telse if (e.shiftKey) {\n\t\t\t\t\t\t// Reverse tabbing order when shift key is pressed\n\t\t\t\t\t\tif (active === elements[0]) {\n\t\t\t\t\t\t\telements.last().focus();\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tif (active === elements.last()[0]) {\n\t\t\t\t\t\t\telements.first().focus();\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}, 0);\n\t}\n});\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n * Statics\n */\n\n/**\n * Show / hide a background layer behind a collection\n * @param {boolean} Flag to indicate if the background should be shown or\n * hidden\n * @param {string} Class to assign to the background\n * @static\n */\nButtons.background = function (show, className, fade, insertPoint) {\n\tif (fade === undefined) {\n\t\tfade = 400;\n\t}\n\tif (!insertPoint) {\n\t\tinsertPoint = document.body;\n\t}\n\n\tif (show) {\n\t\t_fadeIn(\n\t\t\t$('
')\n\t\t\t\t.addClass(className)\n\t\t\t\t.css('display', 'none')\n\t\t\t\t.insertAfter(insertPoint),\n\t\t\tfade\n\t\t);\n\t}\n\telse {\n\t\t_fadeOut($('div.' + className), fade, function () {\n\t\t\t$(this).removeClass(className).remove();\n\t\t});\n\t}\n};\n\n/**\n * Instance selector - select Buttons instances based on an instance selector\n * value from the buttons assigned to a DataTable. This is only useful if\n * multiple instances are attached to a DataTable.\n * @param {string|int|array} Instance selector - see `instance-selector`\n * documentation on the DataTables site\n * @param {array} Button instance array that was attached to the DataTables\n * settings object\n * @return {array} Buttons instances\n * @static\n */\nButtons.instanceSelector = function (group, buttons) {\n\tif (group === undefined || group === null) {\n\t\treturn $.map(buttons, function (v) {\n\t\t\treturn v.inst;\n\t\t});\n\t}\n\n\tvar ret = [];\n\tvar names = $.map(buttons, function (v) {\n\t\treturn v.name;\n\t});\n\n\t// Flatten the group selector into an array of single options\n\tvar process = function (input) {\n\t\tif (Array.isArray(input)) {\n\t\t\tfor (var i = 0, ien = input.length; i < ien; i++) {\n\t\t\t\tprocess(input[i]);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (typeof input === 'string') {\n\t\t\tif (input.indexOf(',') !== -1) {\n\t\t\t\t// String selector, list of names\n\t\t\t\tprocess(input.split(','));\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// String selector individual name\n\t\t\t\tvar idx = $.inArray(input.trim(), names);\n\n\t\t\t\tif (idx !== -1) {\n\t\t\t\t\tret.push(buttons[idx].inst);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if (typeof input === 'number') {\n\t\t\t// Index selector\n\t\t\tret.push(buttons[input].inst);\n\t\t}\n\t\telse if (typeof input === 'object' && input.nodeName) {\n\t\t\t// Element selector\n\t\t\tfor (var j = 0; j < buttons.length; j++) {\n\t\t\t\tif (buttons[j].inst.dom.container[0] === input) {\n\t\t\t\t\tret.push(buttons[j].inst);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if (typeof input === 'object') {\n\t\t\t// Actual instance selector\n\t\t\tret.push(input);\n\t\t}\n\t};\n\n\tprocess(group);\n\n\treturn ret;\n};\n\n/**\n * Button selector - select one or more buttons from a selector input so some\n * operation can be performed on them.\n * @param {array} Button instances array that the selector should operate on\n * @param {string|int|node|jQuery|array} Button selector - see\n * `button-selector` documentation on the DataTables site\n * @return {array} Array of objects containing `inst` and `idx` properties of\n * the selected buttons so you know which instance each button belongs to.\n * @static\n */\nButtons.buttonSelector = function (insts, selector) {\n\tvar ret = [];\n\tvar nodeBuilder = function (a, buttons, baseIdx) {\n\t\tvar button;\n\t\tvar idx;\n\n\t\tfor (var i = 0, ien = buttons.length; i < ien; i++) {\n\t\t\tbutton = buttons[i];\n\n\t\t\tif (button) {\n\t\t\t\tidx = baseIdx !== undefined ? baseIdx + i : i + '';\n\n\t\t\t\ta.push({\n\t\t\t\t\tnode: button.node,\n\t\t\t\t\tname: button.conf.name,\n\t\t\t\t\tidx: idx\n\t\t\t\t});\n\n\t\t\t\tif (button.buttons) {\n\t\t\t\t\tnodeBuilder(a, button.buttons, idx + '-');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tvar run = function (selector, inst) {\n\t\tvar i, ien;\n\t\tvar buttons = [];\n\t\tnodeBuilder(buttons, inst.s.buttons);\n\n\t\tvar nodes = $.map(buttons, function (v) {\n\t\t\treturn v.node;\n\t\t});\n\n\t\tif (Array.isArray(selector) || selector instanceof $) {\n\t\t\tfor (i = 0, ien = selector.length; i < ien; i++) {\n\t\t\t\trun(selector[i], inst);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (selector === null || selector === undefined || selector === '*') {\n\t\t\t// Select all\n\t\t\tfor (i = 0, ien = buttons.length; i < ien; i++) {\n\t\t\t\tret.push({\n\t\t\t\t\tinst: inst,\n\t\t\t\t\tnode: buttons[i].node\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\telse if (typeof selector === 'number') {\n\t\t\t// Main button index selector\n\t\t\tif (inst.s.buttons[selector]) {\n\t\t\t\tret.push({\n\t\t\t\t\tinst: inst,\n\t\t\t\t\tnode: inst.s.buttons[selector].node\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\telse if (typeof selector === 'string') {\n\t\t\tif (selector.indexOf(',') !== -1) {\n\t\t\t\t// Split\n\t\t\t\tvar a = selector.split(',');\n\n\t\t\t\tfor (i = 0, ien = a.length; i < ien; i++) {\n\t\t\t\t\trun(a[i].trim(), inst);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (selector.match(/^\\d+(\\-\\d+)*$/)) {\n\t\t\t\t// Sub-button index selector\n\t\t\t\tvar indexes = $.map(buttons, function (v) {\n\t\t\t\t\treturn v.idx;\n\t\t\t\t});\n\n\t\t\t\tret.push({\n\t\t\t\t\tinst: inst,\n\t\t\t\t\tnode: buttons[$.inArray(selector, indexes)].node\n\t\t\t\t});\n\t\t\t}\n\t\t\telse if (selector.indexOf(':name') !== -1) {\n\t\t\t\t// Button name selector\n\t\t\t\tvar name = selector.replace(':name', '');\n\n\t\t\t\tfor (i = 0, ien = buttons.length; i < ien; i++) {\n\t\t\t\t\tif (buttons[i].name === name) {\n\t\t\t\t\t\tret.push({\n\t\t\t\t\t\t\tinst: inst,\n\t\t\t\t\t\t\tnode: buttons[i].node\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// jQuery selector on the nodes\n\t\t\t\t$(nodes)\n\t\t\t\t\t.filter(selector)\n\t\t\t\t\t.each(function () {\n\t\t\t\t\t\tret.push({\n\t\t\t\t\t\t\tinst: inst,\n\t\t\t\t\t\t\tnode: this\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\telse if (typeof selector === 'object' && selector.nodeName) {\n\t\t\t// Node selector\n\t\t\tvar idx = $.inArray(selector, nodes);\n\n\t\t\tif (idx !== -1) {\n\t\t\t\tret.push({\n\t\t\t\t\tinst: inst,\n\t\t\t\t\tnode: nodes[idx]\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n\n\tfor (var i = 0, ien = insts.length; i < ien; i++) {\n\t\tvar inst = insts[i];\n\n\t\trun(selector, inst);\n\t}\n\n\treturn ret;\n};\n\n/**\n * Default function used for formatting output data.\n * @param {*} str Data to strip\n */\nButtons.stripData = function (str, config) {\n\tif (typeof str !== 'string') {\n\t\treturn str;\n\t}\n\n\t// Always remove script tags\n\tstr = Buttons.stripHtmlScript(str);\n\n\t// Always remove comments\n\tstr = Buttons.stripHtmlComments(str);\n\n\tif (!config || config.stripHtml) {\n\t\tstr = DataTable.util.stripHtml(str);\n\t}\n\n\tif (!config || config.trim) {\n\t\tstr = str.trim();\n\t}\n\n\tif (!config || config.stripNewlines) {\n\t\tstr = str.replace(/\\n/g, ' ');\n\t}\n\n\tif (!config || config.decodeEntities) {\n\t\tif (_entityDecoder) {\n\t\t\tstr = _entityDecoder(str);\n\t\t}\n\t\telse {\n\t\t\t_exportTextarea.innerHTML = str;\n\t\t\tstr = _exportTextarea.value;\n\t\t}\n\t}\n\n\treturn str;\n};\n\n/**\n * Provide a custom entity decoding function - e.g. a regex one, which can be\n * much faster than the built in DOM option, but also larger code size.\n * @param {function} fn\n */\nButtons.entityDecoder = function (fn) {\n\t_entityDecoder = fn;\n};\n\n/**\n * Common function for stripping HTML comments\n *\n * @param {*} input \n * @returns \n */\nButtons.stripHtmlComments = function (input) {\n\tvar previous; \n\t\n\tdo { \n\t\tprevious = input;\n\t\tinput = input.replace(/(