1====== JSON Table plugin ======
2
3---- plugin ----
4description: Integrate Excel like spreadsheet into json plugin.
5author     : Janez Paternoster
6email      : janez.paternoster@siol.net
7type       : syntax, action
8lastupdate : 2023-10-26
9compatible : Hogfather,Igor,Jack Jackrum
10depends    : json
11conflicts  : edittable
12similar    : json, jsoneditor, jsongendoc, struct, edittable
13tags       : data, json, database, editing, tables
14
15downloadurl: https://gitlab.com/dokuwiki-json/jsontable/-/archive/master/json-master.zip
16bugtracker : https://gitlab.com/dokuwiki-json/jsontable/-/issues
17sourcerepo : https://gitlab.com/dokuwiki-json/jsontable
18donationurl: https://paypal.me/jnz022
19
20screenshot_img: https://gitlab.com/dokuwiki-json/jsontable/-/raw/master/demo/screenshot.png
21----
22
23===== Installation =====
24Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
25
26Install also [[https://www.dokuwiki.org/plugin:json|JSON plugin]].
27
28===== Description =====
29JSON Table Plugin is based on [[https://www.dokuwiki.org/plugin:json|JSON plugin]]. It adds a table to the page.  Table can be edited like spreadsheet and data can be saved inside a page without page reload. Table is based on [[https://handsontable.com/|Handsontable]]. Data for the table is defined by JSON plugin. Table has many options, for example: column header, data validator, select.
30
31<code>
32<jsontable id=cars path=cars options='{"colHeaders": ["Year", "Car", "Count"]}'>[
33    ["2017", "Honda", 10],
34    ["2018", "Toyota", 20],
35    ["2019", "Nissan", 30]
36]</jsontable>
37</code>
38
39Here is a [[https://dokuwiki-json-demo.1001beauty.si/|Dokuwiki JSON Demo Server]] with JSON database integrated into DokuWiki. Also source code of this plugin contains demo. You can copy the contents of the demo files into your Dokuwiki and experiment with them.
40
41===== Usage =====
42Syntax is similar as in [[https://www.dokuwiki.org/plugin:json|JSON Data Plugin]]:\\
43''<jsontable'' //attributes// ''>'' //inline_json// ''</jsontable>''
44
45It is parsed with same parser as ''<json>'' elements, so rules for //attributes// and //inline_json// are the same. It loads JSON data the same way, from //src// attribute and from //inline_json//. It only has some extra attributes and additional tab for the table. Data source for the table is JSON data defined by the %%<jsontable>%% element (see attributes 'path', 'src', 'src_ext' and //inline_json//).
46
47==== Attribute 'options' ====
48It must be a valid [[https://json.org/|JSON]] string inside single quotes. Special characters inside string, like ''%%'%%'', ''%%<%%'' or ''%%>%%'', can be passed by ''&apos;'', ''&lt;'' or ''&gt;''. Options are directly passed into [[https://handsontable.com/docs/6.2.2/Options.html|Handsontable options]]. All Handsontable options are freely configurable, except data source. Options may also be defined inside JSON database. In this case they can be referenced from there, for example ''options=%''''$path.to.table_options%''.
49
50==== Attribute 'save' ====
51It specifies, how data are stored into ''//inline_data//''. If set to ''all'', then all 'combined_data' will be stored into 'inline_data' on table change. Otherwise only the difference from 'original data' will be saved. This is the default behavior.
52