xxxxxxxxxx
1
<!-- MDB ESSENTIAL -->
2
<link rel="stylesheet" href="../MDB5/css/mdb.min.css" />
3
<!-- MDB PLUGINS -->
4
<link rel="stylesheet" href="plugins/css/all.min.css" />
5
<!-- Custom styles -->
6
7
8
<div id="datatable"></div>
9
10
<!-- MDB ESSENTIAL -->
11
<script type="text/javascript" src="../MDB5/js/mdb.min.js"></script>
12
<!-- MDB PLUGINS -->
13
<script type="text/javascript" src="../MDB5/plugins/js/all.min.js"></script>
14
<!-- Custom scripts -->
15
<script type="text/javascript"></script>
1
1
xxxxxxxxxx
1
<script >
2
3
4
5
// AJAX request and response handling here
6
const data = {
7
columns: [
8
{
9
label: 'Name',
10
field: 'name'
11
},
12
'Position',
13
'Office',
14
'Age',
15
'Start date',
16
'Salary',
17
],
18
rows: [
19
["Tiger Nixon", "System Architect", "Edinburgh", "61", "2011/04/25", "$320,800"],
20
["Garrett Winters", "Accountant", "Tokyo", "63", "2011/07/25", "$170,750"],
21
["Ashton Cox", "Junior Technical Author", "San Francisco", "66", "2009/01/12", "$86,000"],
22
["Cedric Kelly", "Senior Javascript Developer", "Edinburgh", "22", "2012/03/29", "$433,060"],
23
["Airi Satou", "Accountant", "Tokyo", "33", "2008/11/28", "$162,700"],
24
["Brielle Williamson", "Integration Specialist", "New York", "61", "2012/12/02", "$372,000"],
25
["Herrod Chandler", "Sales Assistant", "San Francisco", "59", "2012/08/06", "$137,500"],
26
["Rhona Davidson", "Integration Specialist", "Tokyo", "55", "2010/10/14", "$327,900"],
27
["Colleen Hurst", "Javascript Developer", "San Francisco", "39", "2009/09/15", "$205,500"],
28
["Sonya Frost", "Software Engineer", "Edinburgh", "23", "2008/12/13", "$103,600"],
29
["Jena Gaines", "Office Manager", "London", "30", "2008/12/19", "$90,560"],
30
["Quinn Flynn", "Support Lead", "Edinburgh", "22", "2013/03/03", "$342,000"],
31
["Charde Marshall", "Regional Director", "San Francisco", "36", "2008/10/16", "$470,600"],
32
["Haley Kennedy", "Senior Marketing Designer", "London", "43", "2012/12/18", "$313,500"]
33
],
34
};
35
36
const instance = new mdb.Datatable(document.getElementById('datatable'), data)
37
38
document.getElementById('datatable-search-input').addEventListener('input', (e) => {
39
instance.search(e.target.value);
40
});
41
42
43
</script>
Console errors: 0