new Table(element, options, ready) → {FooTable.Table}
This class is the core of the plugin and drives the logic of all components.
This:
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
element |
HTMLTableElement | jQuery | The element or jQuery table object to bind the plugin to. | |
options |
object | The options to initialize the plugin with. | |
ready |
function |
<optional> |
A callback function to execute once the plugin is initialized. |
Returns:
- Type
- FooTable.Table
Extends
Members
-
$el :jQuery
-
The jQuery table object the plugin is bound to.
Type:
-
$loader :jQuery
-
A loader jQuery instance
Type:
-
<private, nullable> _resizeTimeout :number
-
The timeout ID for the resize event.
Type:
- number
-
breakpoints :FooTable.Breakpoints
-
The breakpoints component for this instance of the plugin.
Type:
-
<protected> classes :Array.<string>
-
An array of all CSS classes on the table that do not start with "footable".
Type:
- Array.<string>
-
columns :FooTable.Columns
-
The columns component for this instance of the plugin.
Type:
-
<protected> components :object
-
All components for this instance of the plugin. These are executed in the order they appear in the array for the initialize phase and in reverse order for the destroy phase of the plugin.
Type:
- object
Properties:
Name Type Description internal
Array.<FooTable.Component> The internal components for the plugin. These are executed either before all other components in the initialize phase or after them in the destroy phase of the plugin. core
Array.<FooTable.Component> The core components for the plugin. These are executed either after the internal components in the initialize phase or before them in the destroy phase of the plugin. custom
Array.<FooTable.Component> The custom components for the plugin. These are executed either after the core components in the initialize phase or before them in the destroy phase of the plugin. -
data :object
-
The jQuery data object for the table at initialization.
Type:
- object
-
id :number
-
The ID of the FooTable instance.
Type:
- number
-
initialized :boolean
-
Whether or not the plugin and all components and add-ons are fully initialized.
Type:
- boolean
-
o :object
-
The options for the plugin. This is a merge of user defined options and the default options.
Type:
- object
-
rows :FooTable.Rows
-
The rows component for this instance of the plugin.
Type:
Methods
-
<private> _construct(ready) → {jQuery.Promise}
-
Once all properties are set this performs the actual initialization of the plugin calling the FooTable.Table#_preinit and FooTable.Table#_init methods as well as raising the FooTable.Table#"ready.ft.table" event.
This:
Parameters:
Name Type Argument Description ready
function <optional>
A callback function to execute once the plugin is initialized. Fires:
Returns:
- Type
- jQuery.Promise
-
<private> _execute(components, methodName, param1, paramN) → {jQuery.Promise}
-
Executes the specified method with the optional number of parameters on all supplied components waiting for the result of each before executing the next.
This:
Parameters:
Name Type Argument Description components
Array.<FooTable.Component> The components to call the method on. methodName
string The name of the method to execute param1
* <optional>
The first parameter for the method. paramN
* <optional>
<repeatable>
Any additional parameters for the method. Returns:
- Type
- jQuery.Promise
-
<private> _init() → {jQuery.Promise}
-
Initializes this instance of the plugin and calls the callback function if one is supplied once complete.
This:
Fires:
Returns:
- Type
- jQuery.Promise
-
<private> _onWindowResize()
-
Listens to the window resize event and performs a check to see if the breakpoint has changed.
This:
- window
Fires:
-
<private> _preinit() → {jQuery.Promise}
-
The preinit method is called prior to the plugins actual initialization and provides itself and it's components an opportunity to parse any additional option values.
Fires:
Returns:
- Type
- jQuery.Promise
-
destroy()
-
Destroys this plugin removing it from the table.
This:
Fires:
-
<protected> draw() → {jQuery.Promise}
-
Performs the drawing of the table.
This:
Fires:
- FooTable.event:Table"predraw.ft.table"
- FooTable.event:Table"draw.ft.table"
- FooTable.event:Table"postdraw.ft.table"
Returns:
- Type
- jQuery.Promise
-
<protected> execute(reverse, enabled, methodName, param1, paramN) → {jQuery.Promise}
-
Executes the specified method with the optional number of parameters on all components and waits for the promise from each to be resolved before executing the next.
This:
Parameters:
Name Type Argument Description reverse
boolean Whether or not to execute the component methods in the reverse order to what they were registered in. enabled
boolean Whether or not to execute the method on enabled components only. methodName
string The name of the method to execute. param1
* <optional>
The first parameter for the method. paramN
* <optional>
<repeatable>
Any number of additional parameters for the method. Returns:
- Type
- jQuery.Promise
-
raise(eventName, args) → {jQuery.Event}
-
Raises an event on this instance supplying the args array as additional parameters to the handlers.
This:
Parameters:
Name Type Argument Description eventName
string The name of the event to raise, this can include namespaces. args
Array <optional>
An array containing additional parameters to be passed to any bound handlers. Returns:
- Type
- jQuery.Event
-
toCSV(filtered) → {string}
Return the columns and rows as a properly formatted CSV value.
-
Parameters:
Name Type Argument Default Description filtered
boolean <optional>
false Whether or not to exclude filtered rows from the result. Returns:
- Type
- string
-
toJSON(filtered) → {Object}
Return the columns and rows as a properly formatted JSON object.
-
Parameters:
Name Type Argument Default Description filtered
boolean <optional>
false Whether or not to exclude filtered rows from the result. Returns:
- Type
- Object
-
use(type) → {*|null}
-
Attempts to retrieve the instance of the supplied component type for this instance.
This:
Parameters:
Name Type Description type
object The content type to retrieve for this instance. Returns:
- Type
- * | null