DigiComp.FluidJsonViews/README.md

29 lines
1.3 KiB
Markdown
Raw Normal View History

2024-06-02 01:59:15 +02:00
# DigiComp.FluidJsonViews
This package builds upon `DigiComp.FluidRenderFunctions` and uses this, to use a such defined render function to create a simple key/value json view from your QueryResult. Where the key will be the persistence identifier and the value the result of your rendered template.
Let me provide you an example:
```html
<rf:registerRenderFunction as="renderTag">
{subject.name}
</rf:registerRenderFunction>
<fj:fluidJson objects="{tags}" renderFunction="renderTag" searchProperties="{0: 'name'}">
2024-06-02 01:59:15 +02:00
<a href="{dataUri}">jsonView</a>
</fj:fluidJson>
```
If you fetch the jsonView you will see something like this:
```json
{
"recordsTotal": 2,
"recordsFiltered": 2,
"results": [
{"id": "a310057f-869e-419e-b6fe-6c3a00fe444a", "text": "hallo 2"},
{"id": "a310057f-869e-419e-b6fe-6c3a00fe444b", "text": "hallo"}
]
}
```
The provided link will understand three query parameters: `limit`, `term` and `page` - all optional.
If you send a "term" parameter, it will apply an or sql search over all your given search property paths. `limit` and `page` will allow you to paginate the results.
For security and performance reasons, you can define a max limit using the provided values in Settings.yaml. There you can change the default limit (used, if not sent), or disable both (not recommended).