工具提示仅在表的第一页上

tooltips only on first page of table

本文关键字:第一页 工具提示      更新时间:2023-09-26

嗨,我有一个弹性网格来显示我的网站上的一些数据。每行都有一个超链接,当用户将鼠标悬停在它上面时,会显示一个包含更多信息的工具提示。但是,这仅适用于表格上的第一页,当我更改页面时,工具提示停止工作。我知道这是因为我在document.ready中使用了工具提示,但我不确定如何解决问题。任何帮助将不胜感激。我已经为工具提示提供了一个小提琴,但是表格没有分页。请参阅小提琴我也包括下面的代码。这在 document.ready 中调用

    function tooltip(){
           $('#tblOrder tr td a').on('mouseenter', function(event) {
                var id = $('#tblOrder tr[id*="row"]').attr('id').substr(3);
                $(this).qtip({        
                    content: {
                    text: 'Loading.....',
                    ajax: {
                        url: '<%=Url.Action("Alarms") %>',
                        type: 'POST',
                        data: {id: id},
                        success: function (data, status) {
                            this.set('content.text', data);
                        },
                        error: function (xhr) {
                            console.log(xhr.responseText);                  
                                }
                            }
                        },
                        show: {
                            event: event.type,
                            ready: true,
                        effect: function () {
                            $(this).slideDown();
                            }
                        },
                        hide: {
                            effect: function () {
                         $(this).slideUp();
         }
     }
 }, event);
});
};

当您更新#tblOrder内的内容时,您应该重新绑定事件处理程序,或者甚至更容易地将 mouseenter 事件绑定到#tblOrder并使用详细的选择器过滤事件回调。所以代替你的代码 - 使用这个:

$('#tblOrder').on('mouseenter', 'tr td a', function(event) {