forked from rstaib/jquery-bootgrid
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.js
More file actions
45 lines (37 loc) · 952 Bytes
/
plugin.js
File metadata and controls
45 lines (37 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// GRID PLUGIN DEFINITION
// =====================
var old = $.fn.bootgrid;
$.fn.bootgrid = function (option)
{
var args = Array.prototype.slice.call(arguments, 1);
return this.each(function ()
{
var $this = $(this),
instance = $this.data(namespace),
options = typeof option === "object" && option;
if (!instance && option === "destroy")
{
return;
}
if (!instance)
{
$this.data(namespace, (instance = new Grid(this, options)));
init.call(instance);
}
if (typeof option === "string")
{
return instance[option].apply(instance, args);
}
});
};
$.fn.bootgrid.Constructor = Grid;
// GRID NO CONFLICT
// ===============
$.fn.bootgrid.noConflict = function ()
{
$.fn.bootgrid = old;
return this;
};
// GRID DATA-API
// ============
$("[data-toggle=\"bootgrid\"]").bootgrid();