我正在使用datatable 1.10
。我已经创建了一个表格,但我无法设置多个" shift select"在它的行上。
根据DataTables文档:
TableTools has four row selection modes of operation:
none - Default, where no user row selection options are available
single - A single row can be selected
multi - Multiple rows can be selected simply by clicking on the rows
os - Operating System like selection where you can use the shift and ctrl / cmd keys on your keyboard to add / remove rows from the selection.
所以我按如下方式创建我的表:
$("#my-table-div").DataTable({
"retrieve": true,
"pagingType": "full_numbers",
"pageLength": 50,
"lengthMenu": [50, 100, 200],
"dom": '<lfi<t>p>',
"autoWidth": false,
"columns": columnsTable,
"tableTools": {
"sRowSelect": "os"
}
});
正如您所看到的,我使用的是"sRowSelect": "os"
,但肯定无法按照我的意愿行事。我无法获得&#34; shift select&#34;上班。
关于我错过或做错的任何想法?
答案 0 :(得分:2)
以下是live example,您需要添加dataTables.select.min.js
资源来管理select选项。您的选择:"columns": columnsTable
有问题。
$(document).ready(function() {
$('#example').DataTable( {
"retrieve": true,
"pagingType": "full_numbers",
"pageLength": 50,
"lengthMenu": [50, 100, 200],
"dom": '<lfi<t>p>',
"autoWidth": false,
//"columns": columnsTable, <-- options problem
"select": {
"style": "os"
}
} );
} );