I have a View that has been used on a page to display data from a repeatable field group for a while. Today, I added a sorting control to the Search and Pagination section of the view, so that users could control the order of the output. As soon as I did that, the View stopped showing any results, no only outputting "No items found: outer View"
I can't figure out why this is happening nor how to fix it. Can you help?
Hello. Thank you for contacting the Toolset support.
The reason why views was not able to display the repeating field group entry because with the following view you set the ordering setting to a custom field "Nights" and the field "Nights" is actually not the part of the repeating field group "Package" that is why view query get failed.
As you can see now with the following view - I've set the ordering setting to 'Post ID' and Now at least its showing the results :
=> hidden link
The view where I changed the ordering section is as given under:
=> hidden link
Screenshot:
=> hidden link
I see also many notices from the plugin "my-custom-functions".
Do you mean that you want to still add sort by options that you added to the "Search and Pagination" section? If yes, please note that you can add the sorting fields for the fields that belong to the content type to which you set your view to the query. Having said that, You are allowed to add sorting fields that belong to the Repeating field group 'Package' in your current case.
Actually, "Order by" was set to "Field - Nights" for me automatically—I did not manually change that. OI also don't understand why the entire view failed to be produced when set this way. I would expect that if a field was not available to be sorted by, it would just revert to a default sorting method rather than fail to display completely. An error message explaining the issue would help too.
I would expect that if a field was not available to be sorted by, it would just revert to a default sorting method rather than fail to display completely. An error message explaining the issue would help too.
==>
Thanks for your suggestions. I will discuss this with our team lead.
Now that the view is again rendering,
==>
Ok - great.
I notice that the sorting controls that I added are not displayed. I've followed the documentation at https://toolset.com/documentation/user-guides/views/allowing-visitors-to-sort-the-front-end-results/. How can I allow the user to sort the view results by the fields ""field-wpcf-nights", "field-wpcf-fishing-days", "field-wpcf-price"?
==>
First of all, I see you are using the nested views (view inside another view) - I would like to know what results from you want to sort as you can add query filters or sorting option for the fields that belong to the post type you set your view to query by.
I'm trying to provide the ability to sort by fields "Nights", "Fishing Days" and "Price". These fields are all part of the "Package Details" repeatable field group, which belongs to "Lodges" post types. I have used the sorting controls wizard which generated the following code:
I guess you missed to see the key information I shared in my previous reply.
First of all, I see you are using the nested views (view inside another view)
As the view [wpv-view name="package-row"] is nested inside another view "Pricing packages list" so there is no option to sort the package-row view entries.
=> hidden link
Another thing is that you set your both the above view to "Disable the wrapping DIV around the View " which means it will display the raw output. So, pagination, ajax that functionality will not work.
And the main reason is that as the sorting fields such as nights, fishing days and price belongs to the RFG "Package Details" and the view that query the RFG "Package Details" is [wpv-view name="package-row"] which is nested in loop, so even if you try to add sorting controls it will display sorting controls n times per loop of view [wpv-view name="package-row"].
So, to add sorting controls to your view is not feasible or possible.