Hi Team
I am creating a custom Vue App (with frappe ui). I have books which have child chapters - all set up in Frappe and i can display the chapters on the Book Details Page all good.
I would like to have a page per chapter in my app so then when you click on a row it takes you to this page. I can get the list view row to route to my /chapter/{name} but not sure how to then display the child row details. This is my part code but i get a permission error which might be because this code doesn’t work for children?
const chapterResource = createDocumentResource({
doctype: “Chapter”,
name: route.params.name,
auto: true,
parent: route.params.parent,
parenttype: “Book”
})
- Can you use createDocumentResource for child tables
- If not, how to do i get the doc to display the details
Chapter Detail page below:
<template>
<div class="p-5">
<div v-if="chapterDoc">
<h1 class=" font-black text-gray-900 text-3xl">
{{ chapterDoc.name }}
</h1>
</div>
</div>
</template>
<script setup>
import { computed, watch, ref, inject } from "vue";
import { useRoute, useRouter } from "vue-router";
import { Button, createDocumentResource, FeatherIcon, ListView } from "frappe-ui";
const route = useRoute();
const router = useRouter();
const chapterResource = createDocumentResource({
doctype: "Chapter",
name: route.params.name,
auto: true,
parent: route.params.parent,
parenttype: "Book"
})
const chapterDoc = computed(() => {
if (chapterResource.doc) {
return chapterResource.doc
}
})
</script>