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