我有一个带有Datatable(1.10.15)的Thymeleaf模板。 我有这个数据表定义:
foo(&obj.method(:method_name))
但是当我开始表格时,我收到了这个错误:
$(document).ready(function() {
$('#deviceEventTable').dataTable( {
order: [[ 0, "desc" ]],
select: true,
bLengthChange: false,
stateSave: true,
pageLength: 20,
initComplete: function() {
var api = this.api();
var selected = localStorage.getItem( 'DataTables_selected' ).split(',');
selected.forEach(function(s) {
api.row(s).select();
})
}
});
table.on('select.dt deselect.dt', function() {
localStorage.setItem( 'DataTables_selected', table.rows( { selected: true }).toArray() )
})
} );
答案 0 :(得分:2)
您从null
localStorage.getItem( 'DataTables_selected' )
在执行split()