jQuery DataTables头部有两行:第一行列名和排序,第二行过滤 [英] jQuery DataTables two rows in head: first row column names and sorting, second row filtering

查看:459
本文介绍了jQuery DataTables头部有两行:第一行列名和排序,第二行过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

旧版本的数据表(最高1.7。?) ,我曾经能够有一个带有两行列标题的表,其中排序在顶行中完成,并包括列名,并在第二行完成输入和选择的过滤。

In older versions of datatables (up to 1.7.?), I used to be able to have a table with a two row column header, where sorting was done in the top row, and included the column name, and filtering with inputs and selects was done in the second row.

<table>
   <thead>
     <tr>
         <th>Col 1</th>
         <th>Col 2</th>
         <th>Col 3</th>
     </tr>
     <tr>
        <td><input type="text" /></td>
        <td><select><option ....></select></td>
        <td><input type="text" /></td>         
     </tr>
  </thead>
  <tbody>...

版本较高,包括最新版本(1.9。 0),这不再起作用,因为可排序标头被应用于第二行而不是第一行。
有没有办法让这个工作不用额外的插件,如
http://code.google.com/p/jquery-datatables-column-filter/

With higher versions, including the latest (1.9.0), this no longer works, because the sortable header is getting applied to the second row instead of the first row. Is there a way to get this working without resorting to an additional plug-in such as http://code.google.com/p/jquery-datatables-column-filter/ ?

推荐答案

jQuery DataTables作者Allan Jardine指出了一种简单的方法:
使用 bSortCellsTop 选项,自1.8版本开始提供。

jQuery DataTables auther Allan Jardine pointed out a simple way to get this done: use the bSortCellsTop option, available since version 1.8.

http://datatables.net/ref#bSortCellsTop

http://datatables.net/ref

http://datatables.net/forums/discussion/9046/two-rows-in-thead-first-row-for-sorting-第二行换列

+1 for jQuery DataTables!

+1 for jQuery DataTables!

这篇关于jQuery DataTables头部有两行:第一行列名和排序,第二行过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆