otsdaq_utilities  v2_05_02_indev
jquery_wrapper.js
1 /*
2  * This file is part of the Tabulator package.
3  *
4  * (c) Oliver Folkerd <oliver.folkerd@gmail.com>
5  *
6  * For the full copyright and license information, please view the LICENSE
7  * file that was distributed with this source code.
8  *
9  * Full Documentation & Demos can be found at: http://olifolkerd.github.io/tabulator/
10  *
11  */
12 
13  (function (factory) {
14  "use strict";
15  if (typeof define === 'function' && define.amd) {
16  define(['jquery', 'tabulator', 'jquery-ui'], factory);
17  }
18  else if(typeof module !== 'undefined' && module.exports) {
19  module.exports = factory(
20  require('jquery'),
21  require('tabulator'),
22  require('jquery-ui')
23  );
24  }
25  else {
26  factory(jQuery, Tabulator);
27  }
28  }(function ($, Tabulator) {
29 
30  $.widget("ui.tabulator", {
31  _create:function(){
32  var options = Object.assign({}, this.options);
33 
34  delete options.create;
35  delete options.disabled;
36 
37  this.table = new Tabulator(this.element[0], options);
38 
39  //map tabulator functions to jquery wrapper
40  for(var key in Tabulator.prototype){
41  if(typeof Tabulator.prototype[key] === "function" && key.charAt(0) !== "_"){
42  this[key] = this.table[key].bind(this.table);
43  }
44  }
45  },
46 
47  _setOption: function(option, value){
48  console.error("Tabulator jQuery wrapper does not support setting options after the table has been instantiated");
49  },
50 
51  _destroy: function(option, value){
52  this.table.destroy();
53  },
54  });
55  }));