forked from fooplugins/FooTable
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfootable.plugin.template.js
44 lines (36 loc) · 1.18 KB
/
footable.plugin.template.js
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
(function ($, w, undefined) {
if (w.footable === undefined || w.foobox === null)
throw new Error('Please check and make sure footable.js is included in the page and is loaded prior to this script.');
var defaults = {
/*
Plugin options here, example:
var defaults = {
myPlugin: {
enabled: true
}
};
This would allow you to access this option using ft.options.myPlugin.enabled
*/
};
function MyPlugin() {
var p = this;
p.name = 'Footable MyPlugin';
p.init = function(ft) {
$(ft.table).bind({
/*
Bind to relevant events here to modify/add functionality to Footable, example:
$(ft.table).bind({
'footable_initialized': function(e){
if (e.ft.options.myPlugin.enabled === true){
alert('Hello World');
}
}
});
This would listen for the 'footable_initialized' event and when called check if the plugin is enabled
and if it is alert 'Hello World' to the user.
*/
});
};
}
w.footable.plugins.register(MyPlugin, defaults);
})(jQuery, window);