Status: | effective |
Progress: | 100% |
Version: | 1.9.0+ |
Help:Datatables format (legacy)
Datatables format (legacy) | |
---|---|
A progressive table result printer that integrates the DataTables JavaScript library | |
Collection | |
Further Information | |
Provided by: | Extension "Semantic Result Formats" |
Added: | 1.9.0 |
Removed: | still supported |
Requirements: | none |
Format name: | datatables-legacy |
Enabled? Indicates whether the result format is enabled by default upon installation of the respective extension. | yes |
Authors: | James Hong Kong |
Categories: | table |
Group: | smwapi |
Table of Contents | |
Starting with Semantic Result Formats 1.9.0, the powerful DataTables JavaScript library has been integrated to be available as a result printer. This result printer enables advanced interaction such as in-table search, on-the-fly filtering, or variable length pagination.
datatables-legacy
instead of datatables
for the "format" option on an inline query. in contrast to preceding versions. Moreover, do not rely on this result format being available in future releases. Thus it is suggested to migrate to the new result format "datatables"Provides a complete porting of DataTables JavaScript library into Semantic MediaWiki.
Features[edit]
This result printer is a full-fledged JavaScript result printer which works solely based on interacting with the Semantic MediaWiki through its SMWApi, which makes this result printer less dependent on changes within Semantic MediaWiki but also promotes data being dynamically refreshed and adopted while the page is being displayed.
- In-table search
- Result pagination
- Instant update
- Query panel
Query panel[edit]
Along with the "DataTables" plug-in, the query panel (see explanations or see the video on the left side) is an additional component that allows results to be adapted according to a user needs. Meaning that while the in-page inline queries using the #ask
parser function query will carry the responsibility of generating the base table content, the content alteration can be achieved by adapting:
- Parameters such as the limit parameter can be changed on-the-fly
- Table content can be refreshed in a blink of an eye without the need to alter the #ask query
- Conditions can be altered (this is only temporary until the next page refresh, where the original conditions are restored)
- If the user enables the auto-refresh functionality via their user preferences, table content is automatically refreshed during a page refresh/reload
- If the user enables local storage support, result objects are stored for 15 min locally, while image/thumbnail URL information is stored for 24h. Disabling local storage will force the result printer to always request a server response instead of using available cache information.
Usage[edit]
{{#ask: [[Modification date::+]] |?Modification date |format=datatables-legacy }}
Parameters[edit]
General[edit]
A fatal error occurred in the #smwdoc parser function
headers
, link
, order
, searchlabel
and sort
despite them being listed here.Format specific[edit]
Parameter | Type | Default | Description |
---|---|---|---|
class | text | empty | Specify an additional cascading style sheet class |
theme | text | bootstrap | Select a grid theme |
Configuration[edit]
User preferences[edit]
Available user preferences are described here.
Maximum number of results[edit]
Because the results are printed through a single inline query on a single page, the maximum number of rows printed is set by configuration parameter $smwgQMaxInlineLimit
Sets the maximal number of rows ever printed by queries (500 by default) rather than configuration parameter $smwgQMaxLimit
Sets the maximal number of results ever retrieved by queries. The limit parameter will not typically help to increase the number beyond this limit, although this may work after the user has hit the refresh button in the top right.
Note[edit]
In-table images[edit]
Thumbnails (or in-table images) are queried after the table has been generated to keep the browser and the page responsive. After displaying the table, information about an image/thumbnail is requested via ajax. Depending on the server response time, it can take a moment before all image links are replaced with their corresponding thumbnail. If you use the local storage options, image information available to the cache should be instantly available.
Issues with Safari on MW 1.27.x[edit]
In case the results are not loading correctly, you have to upgrade MediaWiki to version 1.27.2 or later or add the following configuration setting to your "LocalSettings.php" file:2$wgLegacyJavaScriptGlobals = false;
Limitations[edit]
- Currently (as of SMW 2.5.x and SMW 2.4.x) default sorting of columns is not supported.3
- Common wiki markup, such as that for italic or bold, is often not rendered by the datatables format. Some of the necessary tags, however, can be replaced using HTML text formatting in their stead (for instance, replace ''italic'' with <i>italic</i>).
- This result format cannot represent values from
- properties of type 'Record' and type 'Reference' (but can render their fields if specified with property-chain printouts, like:
?record property.field property
). - special properties such as "Has type" and "Subproperty of".
- properties of type 'Record' and type 'Reference' (but can render their fields if specified with property-chain printouts, like:
Examples[edit]
See also[edit]
- notes on the "datatable" class of the "table" result format
- notes on this result format for developers
References
- ^ Semantic MediaWiki: GitHub pull request gh:smw:2420
- ^ Semantic Result Formats: GitHub issue comment gh:srf:176:254289047
- ^ Semantic MediaWiki: Default sorting in datatables result format