Allow to create tables with JSON
What does this MR do and why?
Introduce an additional way of creating tables using JSON and code blocks.
```json:table
{}
```
-
Add support to render table using JSON -
Limit configuration of table -
Add test coverage -
Add error handling for when JSON parsing fails -
Add sorting capabilities -
Add filtering capabilities -
Add distinguishing element apart from other tables (added caption)
Screenshots or screen recordings
items
)
Simplest example with just data points({
"items" : [
{"a": "11", "b": "22", "c": "33"}
]
}
fields
)
Explicitly specifying column names({
"fields" : ["a", "b", "c"],
"items" : [
{"a": "11", "b": "22", "c": "33"}
]
}
items
need to have all fields
.
Not all {
"fields" : ["a", "b", "c"],
"items" : [
{"a": "11", "b": "22", "c": "33"},
{"a": "211", "c": "233"}
]
}
fields
is not explicitly specified, the column labels are picked from the first element of items
When {
"items" : [
{"a": "11", "b": "22", "c": "33"},
{"a": "211", "c": "233"}
]
}
Explicitly specifying custom column label
{
"fields" : [
{"key": "a", "label": "AA"},
{"key": "b", "label": "BB"},
{"key": "c", "label": "CC"}
],
"items" : [
{"a": "11", "b": "22", "c": "33"},
{"a": "211", "b": "222", "c": "233"}
]
}
Sortable columns
{
"fields" : [
{"key": "a", "label": "AA", "sortable": true},
{"key": "b", "label": "BB"},
{"key": "c", "label": "CC"}
],
"items" : [
{"a": "11", "b": "22", "c": "33"},
{"a": "211", "b": "222", "c": "233"}
]
}
Table with filter
{
"fields" : [
{"key": "a", "label": "AA"},
{"key": "b", "label": "BB"},
{"key": "c", "label": "CC"}
],
"items" : [
{"a": "11", "b": "22", "c": "33"},
{"a": "211", "b": "222", "c": "233"}
],
"filter" : true
}
Error message
{
"items" : [
{"a": "11", "b": "22", "c": "33"}
],
}
Caption
How to set up and validate locally
- Use code snippets mentioned above with
json:table
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Vishal Tak