braidwoodit
Forum Replies Created
-
and further to this I have resolved the issue I had with the view_id’s not being the same. It’s a hack that updates the id on the event list so that the search form submission and subsequent event list update works.
I can now use the [events_list has_search=”1″] shortcode and it works flawlessly.jQuery(document).ready(function($) {
// Wait until both search form and event view are on the page
function syncViewIDs() {
const $form = $('.em-search-form');
const $view = $('.em-view-container');
if ($form.length && $view.length) {
const viewId = $form.find('input[name="view_id"]').val();
$view.attr('id', 'em-view-' + viewId);
$view.find('.em-events-list').attr('id', 'em-events-list-' + viewId);
$view.find('.em-events-list').attr('data-view-id', viewId);
$view.find('.em-pagination').attr('data-em-ajax', 'id=' + viewId + '&action=search_events');
} else {
// Retry after slight delay if elements not yet present
setTimeout(syncViewIDs, 200);
}
}
syncViewIDs();
});so after all that, the default event search doesn’t search categories but by changing the search options to use the advanced search inline (not modal) and with some additional shortcode attributes such as show_advanced=”1″ and show_main=”0″ I am able to show a nice search form on the right of my events list and have it update the events list with search results from the form.
https://share.cleanshot.com/BsLzjgjhDZwQ3JTBW9vXok I have made a lot of progress on this issue. First thing I learned is that you don’t use a [events_search_form] and an [events_list] as the form submission won’t update the list.
What I needed was the [events_list] shortcode with an *undocumented* attribute has_search=”1″. Now I have a search box that appears as part of the events list. BUT, I now have another issue.
After much diagnosis of the code, I found that the search form code generates a random view_id and the ajax post and subsequent update code uses that view_id to update the event list. It only works when both the search form and the event list have the same view_id in their attributes.
The problem I have is that everytime my shortcode renders, it is generating a different view_id in the form compared to the event view. So a search is submitted and the ajax works (I see the response in the dev tools) but the event list doesn’t get updated because of the view_id mismatch. what a mess.I am using Oxygen Builder… is it possible this is the cause?