Introductory Remarks | |
This tutorial uses the commands parameters and values explained in the PluginLIST documentation on this website and will guide you through the process of creating a simple table to display tracker data in very small steps. The structure for the steps is as following:
Why our devs recommend us to use {LIST()} and to stop using {trackerlist}: With the plugin {LIST()} you can do the same as you can do with plugin {trackerlist}. Advantages of {LIST()} over {trackerlist}:
Disadvantage of {LIST()} over {trackerlist}:
|
What you need to know first | |
{LIST()} has basically two main facets. note On an average shared hosting you can work with "Unified Search" and the option "MySQL Full-text Search as search engine". "Lucene" is possible as well, but not recommended and likely at some day not supported anymore, whilst "Elasticsearch" requires an "Elasticsearch" installation on a dedicated root server. Elasticsearch does not need to be installed on the same server and it is possible to use an external Elasticsearch service, either a self-hosted service or a paid service. In this tutorial we use the standard shared hosting setup with Unified Search + MySQL Full-text Search. This said, we conclude, that plugin {LIST()} uses a "filter command" to filter arbitrary data from the database and some kind of "output command" to display the filtered data. "Format commands" optionally extend the output commands. |
Task: How to filter and display data from a certain tracker? | |
This website has a tracker which contains the features of Tiki (we call it Feature Tracker) and certain descriptive data about those features. Thus we want to display some data of this tracker for demonstration. |
0. basic syntax | |
Please mind, that the sort order of the parameters inside the commands is indifferent (meaning the order is not important). Same as with wiki plugin parameters it has no effect which parameter you write first. But it makes sense to stick to some general order (like a best practice) to make larger LIST plugins better readable by default, which might only perhaps make sense for you alone, but truly makes sense in a team based work environment. Copy to clipboard
Hints: |
1. LIST alone | |
Copy to clipboard
What we did: By only creating the empty List plugin, we already triggered a search query (actually an unspecified search query, searching for simply everything without any output directive). Result: We do not display the result here, to not waste too much space with a long list of unusable results. |
2. filtering the data from one tracker | |
info In the inline command "filter" you usually want to specify the type of object you are filtering (where filtering is limiting the search result to a subset of all database content). As explained above, an empty List plugin would just search for all content that is indexed in Unified Search. As LIST is build upon Unified Search you use Unified Search Fields to specify the filtered objects. This is done with the parameter field in the inline command filter. You find a list of the available fields and a table which features make use of which fields here: Search and List from Unified Index Copy to clipboard
What we did: Here we filter for a tracker Id, so we have the parameter field with the value tracker_Id. Next, the filter command needs some specification which tracker Id we are looking for. There fore we use the parameter 'content with the value 7. {filter field="tracker_id" content="7"} filters for all data that matches with the search for tracker_Id=7, where it does not look for the tracker itself, but for the content of this tracker (we will understand this very point later, just take it as given for now). Result: This result as well has no value for us, but at least we already have broken the issue down to the tracker data we are looking for instead of filtering simply all existing data in the database. We do not display the result here, to not waste too much space with a long list of unusable results. |
3.1 using the table template instead of the default simple list | |
Copy to clipboard
What we did:
Result: At the time of writing this page, the pagination offers 3 pages. As today this Tiki is configured to a standard pagination of 50 items and the tracker Id=7 contains the current features of Tiki 15, we can assume that we have about more than 100 and less than 151 features in Tiki. But why the tracker items are not displayed? The above information seems not to be very useful without any of the features displayed. Easy to answer: |
3.2 limiting the number of (to be) displayed results with the pagination command | |
Copy to clipboard
What we did: Result: |
4. defining columns and display tracker items | ||||||||||||
Please keep in mind: Copy to clipboard
What we did: Result:
|
5. the parameter "content" | |
As seen above, we used the parameter content in the command filter to specify, which tracker (respectively tracker_Id) we are looking for. Reminder:
The parameter content helps us with the second task: defining the part of the subset of the Tiki database data (filter / search results) we actually want to display. Example: Copy to clipboard
What we did: Result: |
6. getting tablesorter into the game | ||||||||||||
Do not forget ... ... to activate tablesorter when using for the first time on a site, cause otherwise it might happen, that it won't work. Please make sure, that you activate the preference jQuery Sortable Tables (We might add a comment to the preference on day to mention that "jQuery Sortable Tables" about equals "tablesorter". Sorry for the confusion.).
You find the preference in /tiki-admin.php?page=features#contentadmin_features-interface. tablesorter will only work in plugin List from Tiki 15 onwards tip For now you can find the tablesorter parameters here at the trackerlist wiki page - the options and parameters are identical with both, the LIST and the trackerlist plugin: https://doc.tiki.org/PluginTrackerList#content_index1-5 Copy to clipboard
What we did: Result:
Alias
|