1
已解决。代码将反映变化(并且有评论)引导工具提示保持打开状态(IE,Firefox)
我将尝试首先简洁地描述问题,然后提供详细信息。
我使用引导程序的工具提示来显示一些文本时,将鼠标悬停在表中单个列下的表数据元素上。要访问此表格,请通过单击下拉列表下的项目导航到该表格。在选择了下拉菜单项之后,如果您的鼠标巧妙地悬停在具有提示的表格/页面的工具提示的表格元素上,则工具提示在页面上保持打开/卡住状态(在IE和Firefox只要)。
以下是呈现表格并生成工具提示的JavaScript。我使用KendoGrid生成并跟踪从数据库中提取的信息。 jQuery,bootstrap,knockout和Kendo是这个网页前端的基础。
有什么我可以重新格式化来解决这个问题?或者任何地方的已知解决方法?所有的输入是赞赏。谢谢!
的JavaScript
var createGrid = function() {
$('#AvailableAttachments').html('').kendoGrid({
columns: self.AvailableColumns(),
dataSource: {
data: [],
sort: self.Type() == 'Labor' ? { field: 'Description', dir: 'asc' } : { field: 'ReferenceNumber', dir: 'asc' }
},
selectable: true,
sortable: true,
scrollable: true,
resizable: true,
change: self.AttachmentGridChange,
dataBound: self.availableGridDataBound
});
};
var updateGrid = function() {
/*Destroy all previous table's tooltips*/
$.each($('#AvailableAttachments').data('kendoGrid').table.find('tr'), function (i, row) {
$(row).find('td.hoverDescription').tooltip('destroy');
});
createGrid();
var selectedCategory = {
/*Grab some parameters*/
};
app.ajaxLoadingPanel = '#AvailableAttachments .k-grid-content';
$.getJSON(app.baseUrl + self.Type.peek() + 'Attachment/Get', selectedCategory, function (data) {
var oldSort = $('#AvailableAttachments').data('kendoGrid').dataSource._sort;
var newDS = new kendo.data.DataSource();
newDS.data(data);
if (typeof oldSort != 'undefined' && oldSort.length > 0) {
newDS.sort(oldSort[0]);
}
$('#AvailableAttachments').data('kendoGrid').setDataSource(newDS);
filterFavorites();
$('#btnEditPart').prop('disabled', true);
$('#btnDeletePart').prop('disabled', true);
$.each($('#AvailableAttachments').data('kendoGrid').table.find('tr'), function (i, row) {
generateToolTip(row);
});
});
}
function generateToolTip(row) {
var description = /*Do some parsing to get the information to display*/
...
...
$(row).find('td.hoverDescription').attr('data-original-title', description);
$(row).find('td.hoverDescription').tooltip({ container: '#AttDescriptionToolTip', placement: 'left', html: true, opacity: 0.7 });
}
我猜工具提示隐藏在bootstrap核心需要“onmouseleave”事件。由于元素已经消失,工具提示保持打开状态。我主要编写一个自定义的JS函数,从主体中删除所有可见的工具提示元素,并在几乎每个按钮单击事件中调用它。 – Noldor
你介意进入更多细节吗?元素在尚未出现时如何消失? ......或者它植根于一个不同的问题,我的表格呈现两次,就像你说的那样,这个元素已经消失了,另一个元素(虽然内容相同)已经取代了它的位置。 – Chris