Skip Navigation

[Resolved] view ajax start without search results

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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: Asia/Kolkata (GMT+05:30)

This topic contains 8 replies, has 2 voices.

Last updated by henriqueD 1 year, 9 months ago.

Assisted by: Minesh.

Author
Posts
#2579945

Hello everything is fine?

I have an ajax view in my project and I would like that when I load the page, only the filters will come, and after I insert some value in the filters, the results will appear, without reloading the page, keeping everything as ajax.

How can I do this?

Thanks

#2581387

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

I would like to know what kind of filters you are having on your view? Do you have text search or dropdown?

#2581433

currently only filters per selector (all are taxonomies).

but does it influence if you have filter for texts too?

#2581449

Minesh
Supporter

Languages: English (English )

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

If you have text search then you must have submit button available as AJAX search is not possible with having text search. Also it does not work even with dropdown filters with block based views so you will have to try the classic view even if you want to use ajax that should work only for dropdown filters with classic views where search form and search result is set on same page.

#2581459

I understood...

I don't want this view to have filters by text, only by select.

One piece of information I forgot to mention: I use the old version of the views plugin, and I use the code editor just like that.

can you help me with this?

#2581463

Minesh
Supporter

Languages: English (English )

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

So whats wrong with that. You can build your view and add your custom field filter and when you add the filter add it as select box from the filter popup. If you already have filter added then you should put your mouse cursor on your exiting filter and click on "Edit filter" button and then change the filter type to select.

#2581501

I understood that part... kkkkk....

What I'm looking for help with is:

I want to know how to hide the results of the view when there is no value selected in the filters.

because in the page layout, it is supposed to display only the filters initially, and the view results only appear when someone selects a filter.

Currently, when the page loads, everything is displayed: both the form with the filters and the part with the results of the view.

remembering that this form is ajax.

#2581517

Minesh
Supporter

Languages: English (English )

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

Here is the reference ticket where I mentioned the solution.

You can add custom CSS and use JS hook to show/hide views output.
=> https://toolset.com/forums/topic/search-do-not-show-items-before-using-filters/#post-1902345

#2581657

I managed to solve...

I used conditional logic + url parameters and it worked, both are the toolset views shortcodes...

Ex:
[wpv-layout-start]

[wpv-conditional if="( '[wpv-search-term param=wpv-custom_param_a]' ne '0' ) AND ( '[wpv-search-term param=wpv-custom_param_a]' ne '' ) OR ( ' [wpv-search-term param=wpv-custom_param_b]' ne '0' ) AND ( '[wpv-search-term param=wpv-custom_param_b]' ne '' ) OR ( '[wpv-search-term param=wpv -custom_param_c]' ne '0' ) AND ( '[wpv-search-term param=wpv-custom_param_c]' ne '' )"]

[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-post-body view_template="loop-item-in-some-view"]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]

[/wpv-conditional]

[wpv-layout-end]

thanks