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

Function Buttons

external/.datatables.js:12814–12862  ·  view source on GitHub ↗
(dt, config)

Source from the content-addressed store, hash-verified

12812 * @param {[type]}
12813 */
12814 var Buttons = function (dt, config) {
12815 if (!DataTable.versionCheck("2")) {
12816 throw "Warning: Buttons requires DataTables 2 or newer"
12817 }
12818
12819 // If not created with a `new` keyword then we return a wrapper function that
12820 // will take the settings object for a DT. This allows easy use of new instances
12821 // with the `layout` option - e.g. `topLeft: $.fn.dataTable.Buttons( ... )`.
12822 if (!(this instanceof Buttons)) {
12823 return function (settings) {
12824 return new Buttons(settings, dt).container()
12825 }
12826 }
12827
12828 // If there is no config set it to an empty object
12829 if (typeof config === "undefined") {
12830 config = {}
12831 }
12832
12833 // Allow a boolean true for defaults
12834 if (config === true) {
12835 config = {}
12836 }
12837
12838 // For easy configuration of buttons an array can be given
12839 if (Array.isArray(config)) {
12840 config = { buttons: config }
12841 }
12842
12843 this.c = $.extend(true, {}, Buttons.defaults, config)
12844
12845 // Don't want a deep copy for the buttons
12846 if (config.buttons) {
12847 this.c.buttons = config.buttons
12848 }
12849
12850 this.s = {
12851 dt: new DataTable.Api(dt),
12852 buttons: [],
12853 listenKeys: "",
12854 namespace: "dtb" + _instCounter++
12855 }
12856
12857 this.dom = {
12858 container: $("<" + this.c.dom.container.tag + "/>").addClass(this.c.dom.container.className)
12859 }
12860
12861 this._constructor()
12862 }
12863
12864 $.extend(Buttons.prototype, {
12865 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Callers

nothing calls this directly

Calls 2

extendMethod · 0.80
$Function · 0.70

Tested by

no test coverage detected