Skip to content

Multiple tables

RedPolygon edited this page Oct 3, 2022 · 2 revisions

Version 1.8 includes the possibility to display multiple tables with each a different set of statistics.

Set up table contents

In config.yml, the tables field is a list of table configurations, each item specifies a table. You can set a table's name, which columns get displayed, by which column to sort and in which direction to sort (all of which are optional). You can add as many tables as you want. For more information, see the Config file wiki page.

If you use the built-in web server, you're done! All tables will be displayed automatically. When using your own index.html, though, let's continue with a bit more setup.

Set up table display (optional, for custom index.html)

There are two ways to set up multiple tables in your own index.html.

  1. Single parent element
    The first option is to add a single <div> to your page which WebStats will automatically populate with the appropriate tables. For this option, specify tableParent in the web configuration as shown in the example index.html.

  2. Manually add <table> elements
    Alternatively, if you want to control where each table appears on your page, you can add a <table> element for each table yourself. Give them an id so you can find them with getElementById.

    In the web configuration, instead of specifying tableParent, add tables. The tables field is an object where the keys are names of tables as specified in Set up table contents. The values are again objects that contain a table field (the <table> element) and a pagination field (the element containing WebStats pagination controls as in the example index.html).

    Also see the web configuration in the example index.html.

Clone this wiki locally