Main Content

Magnolia Community Forums: Get help with Magnolia: Modeling parent child relationships in Content App


  • dandonov
    dandonov
    Full name: Dian Andonov
    Posts: 3
    Last post: Mar 7, 2017 4:53:35 PM
    Registered on: Nov 4, 2016
    Modeling parent child relationships in Content App
    #1 by dandonov on Mar 7, 2017 4:53:35 PM

    Hello,

    my company has been using Magnolia CMS for multiple years. Recently we started utilizing the content applications framework modeling our data in custom applications for each content type. We are looking to model an application for structured questions and answers in a parent child relationship. The treeview in a content applicaiton presents nicely a parent and the assigned children underneath. However when you search and find a parent, the searchview presents only the parent item item found and not the associated children records.
    Looking at the implementation it feel awkward to extend the Lucene search, view presenter and content connector to add the associated records in the resulting listview.
    Furthermore since all components such as the ContentConnector get preconfigured in the yaml descriptor of the application, they are completely stateful in terms of the query that has been executed in against the JCR and which "rootPath" has been queried. We tried to model the children in a separate nodeType so when a query is passed to the children's customized BrowserSubApp ideally loads the children of the queried parent.
    What is Magnolia's support and recommended of implementing a Q and A application ( in terms of content app ) ? Is there a module or a SubApp that can facilitate searches of parents that return the children as well in the resulting view?

  • mgeljic
    mgeljic
    Full name: Mikaël Geljić
    Posts: 69
    Last post: Jul 21, 2017 4:43:24 PM
    Re: Modeling parent child relationships in Content App
    #2 by mgeljic on Mar 8, 2017 8:11:23 AM

    Hi Dian,

    The 'hideInList' property under node-type definitions tells our Vaadin Container how to build the search query.
    It is false by default, so presumably you are currently seeing results from both types, but in a flat list, i.e. without the hierarchy/relationship.

    Unfortunately this is how the search view works in Magnolia—it's built on top of a flat list-view at the moment. In other words, it cannot act like a filter for the tree-view (arguably).

    That said, you can also implement such a filter and configure it under workbench > contentTools (in fact, the search-box is a content tool added by default).
    The typical approach is then to fire an event in order to update the TreePresenter (or instruct it to update the Container).

    Here's an example from our JCR Browser app:

    https://git.magnolia-cms.com/projects/PLATFORM/repos/ui.pub/browse/jcr-browser-app/src/main/java/info/magnolia/jcrbrowser/app/contenttools/JcrBrowserContextTool.java

    https://git.magnolia-cms.com/projects/PLATFORM/repos/ui.pub/browse/jcr-browser-app/src/main/java/info/magnolia/jcrbrowser/app/contentviews/JcrBrowserTreePresenter.java

    Cheers,
    Mika

You don't have the permission to post on this thread

Sign in

To login on this forum, you can use your Magnolia Forge, Support or Partner account, or, below, your Google, Yahoo! or OpenID account. If you have trouble logging in, or any other sort of issue, please let us know in the Meta forum, on the user-list, or simply by email at forum-admin at magnolia-cms dot com.

* Required

... or sign in with:

  • icon http://{your-openid-url}
  • icon
  • icon https://me.yahoo.com/