不要让IE选择并复制使用jQuery .hide()隐藏的表行 [英] Don't let IE select and copy table rows that are hidden using jQuery .hide()
问题描述
我在数据表的顶部有一个jQuery即时搜索栏.所有符合搜索条件的记录将显示为$(row).show()
;其余的隐藏在$(row).hide()
.
I have a jQuery instant search bar on top of a data table. All records matching the search condition will be visible $(row).show()
; and the rest are hidden $(row).hide()
.
问题:
搜索后,我使用鼠标从搜索结果中选择/复制行列表并将其粘贴到Excel中. 隐藏"记录也将被粘贴.
After a search, I use the mice to select / copy the list of rows from search result and paste them into Excel. The "hidden" records also get pasted.
我尝试过:
$(row).css('visibility','collapse');
而不是hide()
-在IE中不起作用(行不会折叠)
$(row).css('visibility','collapse');
instead of hide()
-- doesn't work in IE (Row does't collapse)
我如何在IE中进行"visibility:collapse"工作?还是有解决此问题的其他解决方法?
How do I get "visibility:collapse" work in IE? Or is there a different workaround to this problem?
推荐答案
我建议不要使用IE/Windows隐藏不可见元素的方法,而建议使用结果table
,并克隆搜索结果到table
并隐藏另一个.这样,唯一可以选择的结果就是您要选择的结果.
Rather than try to hide the non-visible elements from IE/Windows, I'd suggest having a results table
, and cloning the results of your search to that table
, and hiding the other. This way the only results available to be selected are the ones that you want to be selected.
这篇关于不要让IE选择并复制使用jQuery .hide()隐藏的表行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!