$('#example').dataTable({
"data": [
// some rows data
['Trident','Internet Explorer 4.0','Win 95+','4','X'],
['Trident','Internet Explorer 5.0','Win 95+','5','C'],
['Trident','Internet Explorer 5.5','Win 95+','5.5','A'],
['Trident','Internet Explorer 6','Win 98+','6','A'],
['Trident','Internet Explorer 4.0','Win 95+','4','X'],
['Trident','Internet Explorer 5.0','Win 95+','5','C'],
['Trident','Internet Explorer 5.5','Win 95+','5.5','A'],
['Trident','Internet Explorer 6','Win 98+','6','A'],
['Trident','Internet Explorer 4.0','Win 95+','4','X'],
['Trident','Internet Explorer 5.0','Win 95+','5','C'],
['Trident','Internet Explorer 5.5','Win 95+','5.5','A'],
['Trident','Internet Explorer 6','Win 98+','6','A']
],
"columns": [
{ "title": "Engine" },
{ "title": "Browser" },
{ "title": "Platform" },
{ "title": "Version", "class": "center" },
{ "title": "Grade", "class": "center" }
],
"initComplete": function(settings, json) {
// show new container for data
$('#new-list').insertBefore('#example');
$('#new-list').show();
},
"rowCallback": function(row, data) {
// on each row callback
var li = $(document.createElement('li'));
for(var i=0;i<data.length;i++) {
li.append('<p>' + data[i] + '</p>');
}
li.appendTo('#new-list');
},
"preDrawCallback": function(settings) {
// clear list before draw
$('#new-list').empty();
}
});
ul{
margin: 0;
padding: 0;
list-style-type: none;
text-align: center;
}
ul li {
display: inline-block;
width: 100px;
border: 1px #CCC solid;
padding: 10px;
margin: 3px;
}
ul li p {
margin-top: 2px;
margin-bottom: 2px;
}
.dataTables_length {
width: 50%;
}
.dataTables_filter {
width: 50%;
}
<link href="http://cdn.datatables.net/1.10.5/css/jquery.dataTables.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.datatables.net/1.10.5/js/jquery.dataTables.min.js"></script>
<table id="example" class="display" style="display: none;" cellspacing="0" width="100%"></table>
<ul id="new-list" style="display: none;" />
DataTables chuyển đổi tất cả mọi thứ để một mạng lưới div dựa trên anyway. Ngoài ra, hãy xem typeahead.js và các giải pháp loại đầu khác. – isherwood
Một biến thể của Select2 cũng có thể hữu ích. http://select2.github.io/examples.html – isherwood
Select2/Chosen là tốt nhưng vấn đề, trong trường hợp này, là chúng tôi muốn có thể cũng có một cái nhìn mắt chim của toàn bộ danh sách tên và chỉ hẹp chúng dựa trên những gì chúng tôi tìm kiếm. Vì vậy, tôi đang tìm kiếm loại Datatables của hành vi nhưng áp dụng cho bất kỳ loại bố trí – lavirius