Basic Datatable

Zero configuration

DataTables has most features enabled by default, so all you need to do to use it with your own tables is to call the construction function: $().DataTable();.

NamePositionOfficeAgeStart dateSalary
Airi SatouAccountantTokyo332008/11/28$162,700
Ashton CoxJunior Technical AuthorSan Francisco662009/01/12$86,000
Brielle WilliamsonIntegration SpecialistNew York612012/12/02$372,000
Cedric KellySenior Javascript DeveloperEdinburgh222012/03/29$433,060
Charde MarshallRegional DirectorSan Francisco362008/10/16$470,600
Colleen HurstJavascript DeveloperSan Francisco392009/09/15$205,500
Garrett WintersAccountantTokyo632011/07/25$170,750
Gloria LittleSystems AdministratorNew York592009/04/10$237,500
Haley KennedySenior Marketing DesignerLondon432012/12/18$313,500
Herrod ChandlerSales AssistantSan Francisco592012/08/06$137,500
NamePositionOfficeAgeStart dateSalary
Showing 1 to 10 of 20 entries

Feature enable

Disabling features that you don't wish to use for a particular table is easily done by setting a variable in the initialisation object.

NamePositionOfficeAgeStart dateSalary
Tiger NixonSystem ArchitectEdinburgh612011/04/25$320,800
Garrett WintersAccountantTokyo632011/07/25$170,750
Ashton CoxJunior Technical AuthorSan Francisco662009/01/12$86,000
Cedric KellySenior Javascript DeveloperEdinburgh222012/03/29$433,060
Airi SatouAccountantTokyo332008/11/28$162,700
Brielle WilliamsonIntegration SpecialistNew York612012/12/02$372,000
Herrod ChandlerSales AssistantSan Francisco592012/08/06$137,500
Rhona DavidsonIntegration SpecialistTokyo552010/10/14$327,900
Colleen HurstJavascript DeveloperSan Francisco392009/09/15$205,500
Sonya FrostSoftware EngineerEdinburgh232008/12/13$103,600
Jena GainesOffice ManagerLondon302008/12/19$90,560
Quinn FlynnSupport LeadEdinburgh222013/03/03$342,000
Charde MarshallRegional DirectorSan Francisco362008/10/16$470,600
Haley KennedySenior Marketing DesignerLondon432012/12/18$313,500
Tatyana FitzpatrickRegional DirectorLondon192010/03/17$385,750
NamePositionOfficeAgeStart dateSalary

Default ordering (sorting)

With DataTables you can alter the ordering characteristics of the table at initialisation time. Using the order initialisation parameter, you can set the table to display the data in exactly the order that you want.

NamePositionOfficeAgeStart dateSalary
Ashton CoxJunior Technical AuthorSan Francisco662009/01/12$86,000
Michael SilvaMarketing DesignerLondon662012/11/27$198,500
Paul ByrdChief Financial Officer (CFO)New York642010/06/09$725,000
Garrett WintersAccountantTokyo632011/07/25$170,750
Tiger NixonSystem ArchitectEdinburgh612011/04/25$320,800
Brielle WilliamsonIntegration SpecialistNew York612012/12/02$372,000
Thor WaltonDeveloperNew York612013/08/11$98,540
Herrod ChandlerSales AssistantSan Francisco592012/08/06$137,500
Gloria LittleSystems AdministratorNew York592009/04/10$237,500
Rhona DavidsonIntegration SpecialistTokyo552010/10/14$327,900
NamePositionOfficeAgeStart dateSalary
Showing 1 to 10 of 20 entries

Multi-column ordering

DataTables allows ordering by multiple columns at the same time, which can be activated in a number of different ways.

Complex headers (rowspan and colspan)

When using tables to display data, you will often wish to display column information in groups. DataTables fully supports colspan and rowspan in the table's header, assigning the required order listeners to the TH element suitable for that column.

NameHR InformationContact
PositionSalaryOfficeExtn.E-mail
Airi SatouAccountant$162,700Tokyo5407a.satou@datatables.net
Ashton CoxJunior Technical Author$86,000San Francisco1562a.cox@datatables.net
Bradley GreerSoftware Engineer$132,000London2558b.greer@datatables.net
Brielle WilliamsonIntegration Specialist$372,000New York4804b.williamson@datatables.net
Cedric KellySenior Javascript Developer$433,060Edinburgh6224c.kelly@datatables.net
Charde MarshallRegional Director$470,600San Francisco6741c.marshall@datatables.net
Colleen HurstJavascript Developer$205,500San Francisco2360c.hurst@datatables.net
Dai RiosPersonnel Lead$217,500Edinburgh2290d.rios@datatables.net
Garrett WintersAccountant$170,750Tokyo8422g.winters@datatables.net
Gloria LittleSystems Administrator$237,500New York1721g.little@datatables.net
NamePositionSalaryOfficeExtn.E-mail
Showing 1 to 10 of 20 entries