Skip Navigation

[Resolved] Displaying Nested Repeatable Groups in a View

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 9 replies, has 2 voices.

Last updated by filipeC 4 weeks, 1 day ago.

Assigned support staff: Minesh.

Author
Posts
#1674193

I am trying to build a View for nested repeatable groups so I can display them in an Elementor template. I've previously created a couple of Views without nesting, so I have the first one working, but can't get the nested group's loop to pull any data.

So far I set up two Views, one for the Mast List and one for the Mast Section List (which is nested inside Mast). The attached screenshots show the current settings for the Mast Section List and what it looks like on the website.

My code is as follows:

Loop Editor (Mast List)

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<ul class="wpv-loop js-wpv-loop">
		<wpv-loop>
              [wpv-post-body view_template="loop-item-in-mast-list"]
		</wpv-loop>
	</ul>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

Loop Item in Mast List

<!-- wp:toolset-blocks/fields-and-text -->
<div class="tb-fields-and-text" data-toolset-blocks-fields-and-text="1">
  <ul>
	<li>[types field='mast-name'][/types]
	  <ul>
		<li>Mast Type: [types field='mast-type'][/types]</li>
		<li>Mast Step: [types field='mast-step'][/types]</li>
        <li>[wpv-post-body view_template="loop-item-in-mast-section-list"]</li>
	  </ul>
	</li>
  </ul>
</div>
<!-- /wp:toolset-blocks/fields-and-text -->

Loop Editor (Mast Section List)

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<ul class="wpv-loop js-wpv-loop">
		<wpv-loop>
              [wpv-post-body view_template="loop-item-in-mast-section-list"]
		</wpv-loop>
	</ul>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

Loop Item in Mast Section List

<!-- wp:toolset-blocks/fields-and-text -->
<div class="tb-fields-and-text" data-toolset-blocks-fields-and-text="1">
  <ul>
	<li>[types field='mast-name-section'][/types]
	  <ul>
		<li>Sail Type: [types field='sail-type'][/types]</li>
		<li>Sail/Spar Name: [types field='sail-spar-name'][/types]</li>
        <li>Height: [types field='mast-height'][/types] m</li>
	  </ul>
	</li>
  </ul>
</div>
<!-- /wp:toolset-blocks/fields-and-text -->
#1674625

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share problem URL where you want to display the nested repeating field group and what nested repeating field group you want to display with that.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1678245

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now: hidden link

I've change the Query Filter as follows for the following view:

Filter by post relationship or repeatable fields group owner
Select items from the Mast group that are related to the Post where this View is shown.

=> hidden link

And within the content template "Loop item in Mast List" I've change the following from:

<li>[wpv-post-body view_template="loop-item-in-mast-section-list"]</li>

To:

 <li> [wpv-view name="mast-section-list"]</li>

I can see its working correctly, Can you please confirm.

#1680677

That is working now, thank you.

How do I get the nested view to line up with the rest of the list? I want the two bullet points marked with a red line in the attached image to be at the same level (the two lines should line up).

#1680753

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Glad to know that solution I shared works for you.

I am not sure how exactly you want to display that but the output is generated from the following views:
=> hidden link
=> hidden link

you can adjust your ul, li tags according to your requirement.

#1681091

It is current displaying as:

-Mast Name
-Mast Type
-Mast Step
-Mast Section 1 <---first line from nested view

I want it to display as:

-Mast Name
-Mast Type
-Mast Step
-Mast Section 1 <---first line from nested view

I want to remove the extra indent at the start of the nested list (Mast Section) so that it lines up with the last line of the outer list (Masts).

I played around with the tags but couldn't figure it out

#1681589

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

The output we get is the correct output generated.

For the "Mizzen Mast" repeating field group entry the "-Mast Step" value is set to "Unknown" and when I checked the value for the "Unknown" option, there is nothing to display:
=> hidden link

Please check the following screenshot: hidden link

Do you want that if the "-Mast Step" value is set to "Unknown", the nested view output should start from the same line where we display the "-Mast Step" value? Is this applicable to only "Unknown" option or irrespective of any option set, you want to display the nested view output from the same line?

what if "-Mast Step" value is set to non empty?

#1682731

It is outputting correctly, I am just not sure how to code it so that the indentation of the lines is what I want it to be. I see that my reply lost the formatting I was asking about, so let me try again.

It's currently displaying as below, because it automatically adds an extra indentation when it starts the Mast Section list.
-Mast Name
---Mast Type
---Mast Step
------Mast Section 1 <---first line from nested view

And I want it to display as below, with the first line from the nested view in line with the last line of the previous view.
-Mast Name
---Mast Type
---Mast Step
---Mast Section 1 <---first line from nested view

#1683335

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

It seems again the format what you added is lost formatting as with your last reply what is current and what you want both section seems almost same as it lost formatting.

What if you try to create a format with google Doc and share that doc link with me so I can see the format or share few more precise screenshots.

#1702875

I figured out the formatting. Thanks for your help with displaying the nested view!