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