I want to select child pages of specific page (for ex: /pages/categories)
If i use query language, i cant select child pages (not shows “icon-angle-right”):
Blueprint
categories:
label: Categories
type: pages
multiple: true
min: 1
max: 5
required: true
options: query
placeholder: Select Categories
query: site.find("categories").children
If remove the query language, i can select but opening all pages. Second image is expected output.
Blueprint:
categories:
label: Categories
type: pages
multiple: true
min: 1
max: 5
required: true
placeholder: Select Categories
Is it possible with query?
This is about following code snippet but i didnt understand about v-if="model"
. Query doesn’t return a model?
<k-button
v-if="model"
:disabled="!page.hasChildren"
:tooltip="$t('open')"
icon="angle-right"
@click.stop="go(page)"
/>
Go to line on GitHub
You can use site.find("categories").index
instead of children
to get the complete tree. The downside is that you get a flat collection, not a tree structure if you use a query.
Thanks. I was tried that but there are dozens categories. I need to show categories as tree. Why doesn’t working when use query? Isn’t possible that get pages as tree with query?
Unfortunately not, but there is already an issue in the ideas repo that you might want to upvote as well_
opened 02:56PM - 12 Mar 19 UTC
closed 01:52PM - 10 Oct 19 UTC
**Current behavior**
Let's say a custom query is used for a `pages` field lik… e so:
```yaml
related:
title: Related pages
type: pages
query: site.homePage.children
```
The `pages` field will now display a list of the pages in the queried collection. Unfortunately, the full page tree is no longer displayed (because of [this line](https://github.com/getkirby/kirby/blob/3.0.3/config/fields/pages.php#L152)), so it's no longer possible to select subpages. Only the pages that are directly in the queried collection can be selected.
**Feature idea**
This may be intended for some use-cases, but in others it might make sense to select subpages as well, e.g. if you want users to select a page from a custom collection that is a filtered tree structure of pages.
**Possible implementations**
I think this should be a blueprint option of the `pages` field.
1. Option 1: Additional blueprint option
```yaml
related:
title: Related pages
type: pages
query: site.homePage.children
querySubpages: true
```
2. Option 2: Nested option
```yaml
related:
title: Related pages
type: pages
query:
query: site.homePage.children
subpages: true
```