Configurations Library
This library makes it possible to receive shop configuration values.
- Source:
- Source:
Methods
(static) ajaxComplete($target, callback)
Sets the callback method when ajax load of data is complete.
This method is useful for checking PHP errors or modifying the data before they are displayed to the server.
Parameters:
Name | Type | Description |
---|---|---|
$target |
jQuery | jQuery object for the target table. |
callback |
function | Provide a callback method called with the "event", "settings", "techNote", "message" arguments (see provided link). |
- Source:
(static) create($target, configuration) → {DataTable}
Creates a DataTable Instance
This method will create a new instance of datatable into a <table>
element. It enables
developers to easily pass the configuration needed for different and more special situations.
Parameters:
Name | Type | Description |
---|---|---|
$target |
jQuery | jQuery object for the target table. |
configuration |
Object | DataTables configuration applied on the new instance. |
- Source:
Returns:
Returns the DataTable API instance (different from the jQuery object).
- Type
- DataTable
(static) error($target, callback)
Sets the error handler for specific DataTable.
DataTables provide a useful mechanism that enables developers to control errors during data parsing. If there is an error in the AJAX response or some data are invalid in the JavaScript code you can use this method to control the behavior of the app and show or log the error messages.
Parameters:
Name | Type | Description |
---|---|---|
$target |
jQuery | jQuery object for the target table. |
callback |
Object | Provide a callback method called with the "event", "settings", "techNote", "message" arguments (see provided link). |
- Source:
(static) get(key) → {Promise}
Get the configuration value by the provided key.
Parameters:
Name | Type | Description |
---|---|---|
key |
Configuration key. |
- Source:
Returns:
The promise will be resolve with the configuration value.
- Type
- Promise
(static) getGermanTranslation() → {Object}
Returns the german translation of the DataTables
This method provides a quick way to get the language JSON without having to perform and AJAX request to the server. If you setup your DataTable manually you can set the "language" attribute with this method.
- Deprecated:
- Since v1.4, use the "getTranslations" method instead.
- Source:
Returns:
Returns the german translation, must be the same as the "german.lang.json" file.
- Type
- Object
(static) getTranslations(languageCode) → {Object}
Get the DataTables translation depending the language code parameter.
Parameters:
Name | Type | Description |
---|---|---|
languageCode |
String | Provide 'de' or 'en' (you can also use the jse.core.config.get('languageCode') to get the current language code). |
- Source:
Returns:
Returns the translation strings in an object literal as described by the official DataTables documentation.
- Type
- Object
(static) indexColumn($target, columnIndex)
Sets the table column to be displayed as an index.
This method will easily enable you to set a column as an index column, used for numbering the table rows regardless of the search, sorting and row count.
Parameters:
Name | Type | Description |
---|---|---|
$target |
jQuery | jQuery object for the target table. |
columnIndex |
Number | Zero based index of the column to be indexed. |
- Source:
(static) prepareColumns($target, columnDefinitions, activeColumnNames) → {Array.<Object>}
Prepare table columns.
This method will convert the column definitions to a DataTable compatible format and also reorder the table header cells of the "thead" element.
Parameters:
Name | Type | Description |
---|---|---|
$target |
jQuery | Table jQuery selector object. |
columnDefinitions |
Object | Array containing the DataTable column definitions. |
activeColumnNames |
Array.<String> | Array containing the slug-names of the active columns. |
- Source:
Returns:
Returns array with the active column definitions ready to use in DataTable.columns option.
- Type
- Array.<Object>