Skip Navigation

[Resolved] Use an AJAX View doesn't update on the fly, when he is nested in another view

This support ticket is created 2 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Our next available supporter will start replying to tickets in about 5.72 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 7 replies, has 2 voices.

Last updated by Lara 2 years, 11 months ago.

Assisted by: Jamal.

Author
Posts
#2239833

Tell us what you are trying to do?

I have an AJAX View with the following settings:
Custom Search Settings: AJAX results update when visitors change any filter values

The View does work when I insert him in a page ( see: hidden link), however when I nest him into another View the ajax updating does no longer work. I need to manually refresh the page to trigger the filtering.
How can I solve that (without adding a search button)?

Is there any documentation that you are following?
no

Is there a similar example that we can see?
no

What is the link to your site?
hidden link

#2239843

Hello and thank you for contacting the Toolset support.

I assume that the parent view uses AJAX too, right? Can you share a URL where nested views are used?

To better understand the issue, I'd like to check it closely. Would you allow me temporary access as an administrator? Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **
Otherwise, would you like to reproduce the issue on one of our test sites?

#2243387

Hello Lara and thank you for the credentials. However, I still do not understand the issue fully. Please help me understand the issue.

Following the page, and inspecting the generated page, it seem that you are nesting too many levels of views:
- The page uses the view "Trainingsanlagen --> Container 1: Benutzer 2.0" hidden link
- This view uses the view "Trainingsanlagen --> Container 2: Reitanlage 2.0" hidden link
- This view uses the view "Trainingsanlagen / RASK --> Tage 2.0" hidden link
- This view uses the view "AAAA Test view" hidden link

This last view expects two filters passed in URL parameters, but they do not have a corresponding control filters. Check this screenshot hidden link

I assume that you are talking about this last view, right? Can you elaborate more what you want to achieve? What would you expect?
Can you also explain the goal of all these nested views? Maybe there is a better way to achieve it.

#2245629

Hello Jamal, many apologies for the delay.
I was distracted because I am having exams at the moment.

I have removed the two filters, who do not have corresponding control filters. Sorry, my fault.

I created a little youtube video, where I try to explain, what I try to achieve:
hidden link
so basically, my idea is to insert the form (see video) in the ajax view, so that the form will only be shown, if the ajax view doesn't output a result. But to achieve this, the ajax view has to work properly.

-----------------------------------------
Can you also explain the goal of all these nested views? Maybe there is a better way to achieve it.
-----------------------------------------
Yes it is a membership page for riding clubs. The first view loads the post page of the user. The second view loads the riding club, who is related to the user through/with a Toolset relationship. The third view loads "days" --- it's kind of a journal, where the members of the riding club can enter appointments or they can "book" certain training facilities.

#2245935

Thank you for the video and good luck with your exams. However, I am afraid, I still do not fully understand the use case.

So, I tried to see if nested views with AJAX search may reproduce this issue in a minimal setup. You can log in to my test site with the following URL hidden link
I create a custom post type Documents. And One-to-many relationship to Posts. Then I created multiple posts with categories assigned to them.
Then I created the first view(Documents view) to get all the documents hidden link
Then I created a view for posts with category filter on it. The posts are all linked to documents posts. So, I set a query filter on this view to get the posts linked to the current document on the loop. And I inserted it inside the loop of the first view.
The issue was not reproduced, you can check it here hidden link
Each view's AJAX search works independently than the other views. However, if I reloaded the page, while it has the search parameters on the URL, the search filters on all the nested views are affected(selected). Check this example hidden link

But, if I deactivated the option to "Enable history management setttings for AJAX custom search" in Toolset->Settings->Front-end Content->Browser history management->Browser history management for AJAX custom searches, reloading the page will empty all the filters(which is somehow expected), and which may be a viable workaround for your case. However, please note that this setting is global to all the views of the website.

My test was rather simpler than yours, with only 2 views instead of 4. I am afraid I still need further explanation from your side. Or an example to test with, something like:
1. I go to xxx
2. I do xxx
3. I do xxx
4. I expect to have xxx (Please explain why you would expect that, it will definitely help me fully better understand this case)
5. Instead i get xxx

#2247233

Hello Jamal,
many thanks for the testpage with the minimal setup. Yes, I see, that it works properly. This is strange. I have tried to reproduce your minimal testpage:

I have created a nested view, that only contains two views:
1. page: hidden link
2. parent-view: hidden link
3. child-view: hidden link

Also, I have deactivated and deleted all plugins, all custom code snippets and I have switched to the WordPress Theme twenty-twenty-one, however in my minimal setup the problem persists, see hidden link
Do you see the same behaviour within the testpage, that I have shown you in the video? That the filter disappears and all filters seem to only interact with the first loop element?

(You should be able to login with the same credentials)

#2248983

I can see the issue on this page, and I may agree that filtering one nested view should not affect the other views, but I still do not see the complete picture.

I added post ID, and post link on the parent view for an easier browsing through the results. I followed the first post (#13287 - neuer Tag) at hidden link
And it does not have any relation with the Events post type that is queried on the nested view. So, I wonder why this nested view is put there. Please bear with me and explain once again what you want to achieve. I am sure you will understand that the language barrier does not help me understand, from a functional perspective, what are the custom post types, and what are the fields. So, it is a bit hard for me.

I also do not find a relationship between Tage(1st view posts) and Events(nested views posts) that could explain the use of these nested views. With this current setup, all the nested views will return the same results. Does it make sense? If, it does, I don't see any use for the AJAX filter then.

Are you looking to get the Events posts that have the same value as the date field(RASK | Datum des Tages*) from the Tage post?

#2249121

Many thanks Jamal : ) !

"Are you looking to get the Events posts that have the same value as the date field(RASK | Datum des Tages*) from the Tage post?" --> Yes exactly. That's what I try to achieve. However for testing purpose I didn't set up the filter - and this was actually the bug, that caused the problem.

Since the filter is in place the ajax works as expected... Thank you so much and also thank you so much for your patience with me.

Kind regards
Lara