包含下拉选择(在正文中,而不是标题或过滤器)的Tablesorter在IE中不起作用

时间:2014-09-02 18:24:38

标签: javascript tablesorter

我正在使用tablesorter,在表的主要部分中,其中一列有一个下拉选择。 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中实现这项工作的任何想法?谢谢,

1 个答案:

答案 0 :(得分:1)

这似乎是IE中的一个错误...我设置this demo来显示问题(reported)。

要解决此问题,您可以在$(':focus').blur();文件(line 107)中注释掉parser-input-select.js,假设您使用该文件来解析选择值:< / p>

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;
};