/ui/utils/jsonDataview
The jsonDataview module exports as default an object with a create method for JSON dataviews.
- Source
Requires
Methods
(async, inner) create(dataview)
The create [json] dataview method sets default props for the creation of a jsoneditor dataview element.
The setData method is assign to set the json content of the jsoneditor element.
The setData method will be called if data is provided with the dataview object.
Name | Type | Description |
---|---|---|
dataview | dataview | Dataview object. |
Name | Type | Description |
---|---|---|
dataview.data | object | A JSON data object to be assigned as data to the Json dataview. |
dataview.props | object | Custom properties for the jsoneditor element. |
- Source
(inner) jsonfile(dataview) → {HTMLElement}
The button method creates a button element.
The button will call the textFile utility method to create a json file download.
Name | Type | Description |
---|---|---|
dataview | dataview | Dataview object. |
- Source
Returns the button element.
- Type:
- HTMLElement
(inner) setData(data)
The [json] dataview setData method calls the set method of the dataview.jsoneditor control to set the data as json content.
Name | Type | Description |
---|---|---|
data | Object | JSON data. |
- Source
(inner) sqlinsert(dataview) → {HTMLElement}
The sqlinsert toolbar function makes the JSONEditor writable. The text content will be passed as POST body to the query defined in the sqlinsert configuration.
"toolbar": {
"sqlinsert": {
"layer_template": "scratch",
"template": "sql_table_insert",
"table": "sql_insert"
}
}
The default sql_table_insert query module can be used to securely load a JSON body into a SQL table.
Name | Type | Description |
---|---|---|
dataview | dataview | Dataview object. |
Returns the button element.
- Type:
- HTMLElement