Skip Navigation

[Resolved] Tooltip does not load properly after Ajax filters used in view

This support ticket is created 4 years, 2 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
- 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: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by CharleneD1435 4 years, 2 months ago.

Assisted by: Waqar.

Author
Posts
#1523765

Tell us what you are trying to do?
I am setting up a directory for Monsters for a mobile game with Toolset view using the filters and search function provided in the view. The monsters are showing a tooltip to explain their skills. The tooltip works as expected on first page load, so you can see what my intention was. However once a filter is applied to the content, the tooltip only shows raw html code instead.

What is the link to your site?
hidden link

Further explenation:
After the filters are used on the front page, like for example you filter by element "Dark" the page loads all the "Dark Monsters" perfectly. So far so good.

However, the page is provided with tooltips which are seen on the skills from the monsters. The smaller images inside the monster cards.

When the ajax has adapted the view by the provided filters the tooltip is no longer executed but shows the raw html code instead of the proper make up. Now I saw in another thread this had something to do with Jquery having to reload after an ajax result but I could not follow the explenation to what needed to actually be done so to make the tooltips html execute again.

If I make the page fully refresh instead of ajaxing the result the tooltips work without a problem. However this causes the issue that my visitors think that the filters don't work. Because they set a filter and expect to see the results instead they select a filter and must press enter in the search field to update the results. This is confusing and not very user friendly so I really want the tooltips to work after updating the results with ajax.

#1524455

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Charlene,

Thank you for contacting us and I'd be happy to assist.

To suggest the best way to re-initialize the tooltip script, after the results have updated through the AJAX, I'll need to see exactly how this view is set up in the admin area.

Can you please share temporary admin login details in reply to this message?

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

regards,
Waqar

#1526593

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing the admin access.

I noticed that the following script is included in the view "Skills", to initialize the Tooltip script:


(function($) {
        $(document).ready(function() {

                $('[data-toggle="tooltip"]').tooltip();

        });
})(jQuery);

But this only executes when the page loads or reloads. To make it also execute when the results have updated through AJAX (i.e. without a page reload), you can include the following function in the "Monster Archive" view:
( screenshot: hidden link )


function resultsUpdated(){
  jQuery('[data-toggle="tooltip"]').tooltip();
}

Next, you'll add this new function's name "resultsUpdated" in the "will run after updating the results" field, under the "Custom Search Settings" section, in the same view.
( screenshot: hidden link )

I hope this helps and please let me know if you need any further assistance around this.

#1526745

That solved it! Thank you so much for the clear and easy to follow instructions.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.