Skip Navigation

[Resolved] Ajax Search results not working in Elementor when views is splited

This support ticket is created 5 years, 8 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.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 6 replies, has 2 voices.

Last updated by davidB-40 5 years, 8 months ago.

Assisted by: Nigel.

Author
Posts
#1209074

I am trying to: Insert a View in Elementor inside 2 container separated but on the same page with Ajax result when user change any input values. When the view is setup to show both the search and results, the Ajax is working fine like you can see on the website now. Whenever I split the views to put the filter in one container and (on the same page) put the results in another container, the Ajax isn't working anymore. All that is done in an Elementor Archive Template. Is it an Elementor issue or it's a bug with Views plugins? I know that if I had JS error in the console it can affect the ajax. I'm actually using Twenty Nineteen Theme and there is a JavaScript error whenever I click on the page (you can see it live on the website). So I changed the theme to Hello Theme for Elementor which didn't have any JS Error in the console and the Ajax filter still isn't working..

Link to a page where the issue can be seen:
hidden link

#1209391

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Dave

I tried this on a local test site and didn't have any problem with it.

I have a View with a search filter that updates via ajax.

I designed a page with Elementor and added View module where I specified only the search form was to be displayed, and then later on that same page I added a second View module where I specified the results from the same View should be displayed.

Visiting the page on the front end and changing the filter updates the results via ajax, as expected.

I checked after updating all plugins to latest versions.

If you are seeing something different can you disable all plugins except Toolset & Elementor/Elementor Pro and test again.

Btw, if you are seeing a JS error when using twentynineteen you shouldn't ignore it, it is indicative of a problem.

#1209426

Hi Nigel, thank you for your reply. I changed the theme to use Elementor-Hello-Theme so now there is no more errors in the console. The only plugins I have is Toolset Types, Views and Maps, WPML Core plugins + WPML All Import, WP All Import and my custom plugin for adding custom CSS and JS. I deactivate all my plugins except for Elementor, Elementor Pro and Toolset suites and the problem is still there... I created a new page and done the same thing and now it work only on the test page. I think there is a problem with an Archive page, because I used the same view on the test page as the archive page. Do you now why on my archive page it's not working? All my plugins are up to date.

Test page: hidden link
Arhcive page: hidden link

#1209502

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

The Toolset integration with Elementor doesn't cover archives.

With Toolset alone to add custom search to an archive you would create a custom archive with search at Toolset > WordPress Archives.

Whenever you visited the URL of the archive you would see the custom archive (with search).

You have created a template for custom archives with Elementor and inserted a View into it.

A View and an archive are similar, but not the same.

When you use Toolset to create a custom archive as described above you are modifying the built-in WordPress query that happens automatically on an archive page.

A View is used to create a completely new query.

Adding a View to an archive means running duplicate queries on the page: the built-in archive query (even if you are not displaying its results) plus the View query.

So, although I have tested and confirmed what you describe, I would say that it is not intended. Not least because Toolset custom archives do not support splitting the search form and the results.

You could propose supporting custom archives in Elementor via a Toolset archive widget: https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

#1209596

Alright but is it good if I insert only one views which display booth the search form and the result on my Elementor Archive Template or it's bad practice because it will duplicate my queries? Does it will slow down my Elementor Archive Page? Because only one view with both search and result is working fine within Elementor Archive Template.

#1209835

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

WordPress will always run the archive query on an archive page, so if you put a View there instead then, yes, it will work, but it does mean running an extra query. That would probably only be significant if your site gets a lot of traffic or you are on a cheap shared host.

Although it is possible, because using a View in this way is not the expected use I don't think "fixing" the issue would be a very high priority, which is why I haven't suggested it.

#1211381

Alright thank you!