包含下拉选择(在正文中,而不是标题或筛选器中)的表分类器在IE中不起作用

Tablesorter containing a dropdown select (in body, not header or filter) not working in IE

本文关键字:筛选 不起作用 IE 分类器 选择 正文 包含下 标题      更新时间:2023-09-26

我使用的是表分类器,在表的主部分,其中一列有一个下拉选择。在Chrome和Safari中一切都很好,但在IE 11中,下拉菜单不起作用。如果你点击下拉列表,选择列表会弹出,但随后会消失。只要你按下按钮,它就会一直打开,但你仍然无法选择任何选项。

 $("#mytable")
    .tablesorter({
        theme: 'blue',
        headerTemplate: '{content} {icon}',
        widthFixed: false,
        widgets: ['zebra', 'filter', 'scroller'],
        widgetOptions: {
            scroller_height: 300,
            scroller_barWidth: 18,
            scroller_upAfterSort: true,
            scroller_jumpToHeader: true,
            scroller_idPrefix: 's_'
        }
    });
<table id="mytable" class="tablesorter">
  <thead>
    <tr>
      <th>ID</th>
      <th>Type</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>1</td>
      <td>
        <select id="type" name="type">
          <option value="1">Type 1</option>
          <option value="2">Type 2</option>
        </select>
      </td>
    </tr>
  </tbody>
</table>

关于如何在IE中完成这项工作,有什么想法吗?谢谢你,

这似乎是IE中的一个错误。…我设置了这个演示来显示问题(已报告)。

为了解决这个问题,您可以注释掉parser-input-select.js文件中的$(':focus').blur();(第107行),假设您正在使用该文件来解析选择值:

restoreValue = function(){
    // focused = false; // uncomment this line to prevent auto-accepting changes
    // make sure we restore original values
    // $(':focus').blur();   <-- **** comment out this line! ****
    return;
};