Difference between revisions of "Paging Plugin"

From MSX - Wiki
Jump to navigation Jump to search
Line 56: Line 56:
  
 
=== Demo ===
 
=== Demo ===
* Launch via App: https://msx.benzac.de/?start=content:https://msx.benzac.de/info/xp/data/plugin_test_12.json
+
* Launch via App: https://msx.benzac.de/?start=menu:https://msx.benzac.de/info/xp/data/plugin_test_12.json
 
* Launch via Demo Page: https://msx.benzac.de/info/?start=content:https://msx.benzac.de/info/xp/data/plugin_test_12.json
 
* Launch via Demo Page: https://msx.benzac.de/info/?start=content:https://msx.benzac.de/info/xp/data/plugin_test_12.json
  

Revision as of 13:59, 9 February 2024

This is a special interaction plugin that allows you to integrate paging into templated content items (i.e. a Content Root Object that uses the template and items properties). In order to use this plugin, a corresponding content service must be implemented that processes the requested items (i.e. by evaluating the offset and limit parameters). The plugin can be used with version 0.1.82 or higher.

Usage[edit]

The plugin must be loaded with a content service URL that is able to evaluate the offset and limit parameters. Optionally, the requested limit can be indicated (by default, it is set to 20). Please see following action syntax examples.

The content service URL should contain the keywords {OFFSET} and {LIMIT}, which are replaced with the corresponding values. Please see following action syntax examples.

If you would like to use the plugin as reference to implement your own plugin, please have a look at this implementation script: http://msx.benzac.de/interaction/js/paging.js.

Syntax[edit]

Parameter syntax of content service URL for paging plugin
Parameter Type Default Value Mandatory Description
offset number 0 Yes

The offset that specifies from which offset the items should start.

Note: The initial request from the pagaing plugin will always have the offset 0. If an offset greater than 0 is requested, the content service only needs to return the items property, because the other properties are inherited from the initial request.

limit number 20 Yes

The limit that specifies how many items should be returned.

Note: If the content service returns less or more items then indicated, no additional items will be requested.

Example[edit]

Screenshot[edit]

Example Screenshot (Paging Plugin)

Code[edit]

{
    "headline": "Paging Examples",
    "menu": [{
            "label": "Paging Example 1",
            "extensionLabel": "Limit: 20",
            "data": "request:interaction:http://msx.benzac.de/services/paging.php?offset={OFFSET}&limit={LIMIT}|20@http://msx.benzac.de/interaction/paging.html"
        }, {
            "label": "Paging Example 2",
            "extensionLabel": "Limit: 30",
            "data": "request:interaction:http://msx.benzac.de/services/paging.php?offset={OFFSET}&limit={LIMIT}|30@http://msx.benzac.de/interaction/paging.html"
        }, {
            "label": "Paging Example 3",
            "extensionLabel": "Limit: 40",
            "data": "request:interaction:http://msx.benzac.de/services/paging.php?offset={OFFSET}&limit={LIMIT}|40@http://msx.benzac.de/interaction/paging.html"
        }]
}

Demo[edit]

See also[edit]