Skip to content

Commit 39e5e99

Browse files
committed
Document generate_nested_nrel_forms in editConfig, rework editConfig documentation
1 parent fb167cb commit 39e5e99

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

src/configuration/ThemesConfiguration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ The format of the theme definitions is as follows:
199199
| `"extraPrintParameters": "<&KEY=VALUE>",` | Optional, additional query parameters to append to GetPrint request (requires QGIS Server >= 3.32.0). |
200200
| `"extraPrintLayers": ["<layername>", ...],` | Optional, extra list of layers to mark as internal print layers, i.e. which are omitted from the QWC2 LayerTree. |
201201
| `"printLabelBlacklist": ["<LabelId>", ...]` | Optional, list of composer label ids to not expose in the print dialog. |
202-
| `"editConfig": "<editConfig.json>"` | Optional, object or path to a filename containing the editing configuration for the theme, see [Editing](#editing). |
202+
| `"editConfig": {<editConfig>} ` | Optional, object containing the editing configuration for the theme, see [Editing](#editing). |
203203
| `"snapping": {...},` | Optional, snapping configuration, see [Snapping](../topics/Snapping.md). |
204204
| `"flags": ["<flag1>", "<flag2>", ...],` | Optional, list of arbitrary flag names. The visibility of menu items, toolbar items and map buttons can be controlled based on the flags a theme declares. See [Plugin Configuration](ViewerConfiguration.md#plugin-configuration). |
205205
| `"config": {` | Optional, per-theme configuration entries which override the global entries in `config.json`, see [Viewer Configuration](ViewerConfiguration.md).|

src/topics/Editing.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,19 @@ In a manually created Qt-Designer Ui form, you can use key-value relations for c
6363

6464
For `Autogenerated` and `Drag and Drop Designer` forms, configure the 1:N relation in QGIS Project &rarr; Properties &rarr; Relations. Note that the child table foreign key must refer to parent primary key.
6565

66-
By default, a table widget similar to an attribute table will be generated to manage the relation values. If you set `generate_nested_nrel_forms` to `true` in the config generator config, the relation values will be displayed as a list of buttons which open the record in a nested form. The button label is chosen according to the following rules:
66+
By default, a table widget similar to an attribute table will be generated to manage the relation values. You can switch to a list of child entries which, when clicked, are displayed in a nested form by setting `generate_nested_nrel_forms` to `true` as follows:
67+
68+
* In the toplevel `config` section of the `tenantConfig.json`. This will apply globally to all datasets.
69+
* In the `editConfig` section of a theme in `themesConfig.json` (see also [`editConfig`](#edit-config) below). This will then apply only to the respective dataset. Example:
70+
```
71+
"editConfig": {
72+
"<LayerId>": {
73+
"generate_nested_nrel_forms": true
74+
}
75+
}
76+
```
77+
78+
The label of the entry in the child entry list is chosen according to the following rules:
6779

6880
* The display name (Layer properties &rarr; Display &rarr; Display Name) of the referencing layer, if the expression is a single field name.
6981
* The primary key value of the referencing layer.
@@ -119,15 +131,8 @@ The `qwc-data-service` offers some basic functionality for logging mutations:
119131

120132
*Note*: for these fields to be written, ensure the qgis project is also up-to-date, i.e. that contain the up-to-date table schemas. You can set the respective field types to hidden in the QGIS layer properties to avoid them showing up in the autogenerated edit forms.
121133

122-
123-
## Using a custom editing backend
124-
125-
You can also use a custom editing backend instead of the `qwc-data-service` by following these steps:
126-
127-
- Implement the custom editing interface, taking [default `EditingInterface.js`](https://github.com/qgis/qwc2/blob/master/utils/EditingInterface.js) as a template.
128-
- Enable the desired editing plugins in [`js/appConfig.js`](https://github.com/qgis/qwc2-demo-app/blob/master/js/appConfig.js), passing your custom editing interface to `Editing`, `AttributeTable` and `FeatureForm`.
129-
- Set up an editing backend.
130-
- If you are using the [`qwc-config-generator`](https://github.com/qwc-services/qwc-config-generator), the edit configuration will be automatically generated from the QGIS project. Otherwise, you need to write a custom `editConfig` in `themesConfig.json` as follows:
134+
## The theme `editConfig` block<a name="edit-config"></a>
135+
The [`qwc-config-generator`](https://github.com/qwc-services/qwc-config-generator). will automatically generate the `editConfig` for a theme in `themesConfig.json`. You can however also specify it manually, in which case the manually defined entries will be merged with the automatically generated entries. The structure of the `editConfig` block is as follows:
131136

132137
| Entry | Description |
133138
|--------------------------------------|---------------------------------------------------------------|
@@ -136,7 +141,7 @@ You can also use a custom editing backend instead of the `qwc-data-service` by f
136141
| `⁣    "layerName": "<LayerName>",` | The layer name to show in the selection combo box. |
137142
| `⁣    "editDataset": "<DatasetName>",`| The name of the edit dataset passed to the editing interface. |
138143
| `⁣    "geomType": "<GeomType>",` | The geometry type, either `Point`, `LineString` or `Polygon`. |
139-
| `⁣    "displayField": "<FieldId>",` | The ID of the field to use in the feature selection menu. |
144+
| `⁣    "displayField": "<FieldId>",` | The ID of the field to use in the feature selection menu. |
140145
| `⁣    "permissions": {` | A list of different write permissions to specify rights and buttons. |
141146
| `⁣      "creatable": <boolean>,` | If `true`, `Draw` button will appear in Editing interface and `Add` button in Attribute Table. |
142147
| `⁣      "updatable": <boolean>,` | If `true`, `Pick` button will appear in Editing interface. |
@@ -151,9 +156,16 @@ You can also use a custom editing backend instead of the `qwc-data-service` by f
151156
| `⁣        ...` | For regular HTML input types, the ReactJS API name of any applicable [HTML input constraint](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input), i.e. `maxLength` or `readOnly`. |
152157
| `⁣      }` | |
153158
| `⁣    }],` | |
154-
| `⁣    "form": "<PathToUiFile>",` | Optional, a QtDesigner UI file. |
159+
| `⁣    "form": "<PathToUiFile>",` | URL to a Qt Designed UI form (use `:/<path>` to specify a path below the `assets` folder).|
160+
| `⁣    "generate_nested_nrel_forms": <boolean>` | Optional: Tell the config-generator whether 1:N relations of this dataset should be displayed in nested forms. |
155161
| `⁣  }` | |
156162
| `}` | |
157163

158-
* If you specify just `fields`, a simple form is autogenerated based on the field definitions.
159-
* Alternatively you can specify the URL to a Qt Designer UI form in `form` (use `:/<path>` to specify a path below the `assets` folder).
164+
165+
## Using a custom editing backend
166+
167+
You can also use a custom editing backend instead of the `qwc-data-service` by following these steps:
168+
169+
- Implement the custom editing interface, taking [default `EditingInterface.js`](https://github.com/qgis/qwc2/blob/master/utils/EditingInterface.js) as a template.
170+
- Enable the desired editing plugins in [`js/appConfig.js`](https://github.com/qgis/qwc2-demo-app/blob/master/js/appConfig.js), passing your custom editing interface to `Editing`, `AttributeTable` and `FeatureForm`.
171+
- Set up an editing backend.

0 commit comments

Comments
 (0)