简体   繁体   中英

tooltip stops working after filter action

I am applying bootstrap popover with ember cli . works great but when I use another action to filter the page, the popovers do not work anymore. To bind the popover I'm using the following: views/restaurants/search-results.js

import Ember from 'ember';

export default Ember.View.extend({
    jqueryEvents: function(){
    Ember.$('[data-toggle="popover"]').popover();
  }.observes('controller.filteredRestaurants').on('didInsertElement')
});

my application.js controller has an action that transitionsToRoute search-results.js which updates the filteredRestaurants property and when it does, the popover stops working.

One thing that could be adding complexity is that search-results template loops the restaurants that are filtered and each restaurant has a partial with the button that is bound to the tooltip inside the partial for each restaurant.

export default Ember.View.extend({
    jqueryEvents: function(){
       Ember.$('body').on('mouseover', '*[data-toggle="popover"]', function() {
          $(this).popover();
          $(this).popover('show');
       });
    }.observes('controller.filteredRestaurants').on('didInsertElement')
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM