Tired of users swiping sideways to read your tables on phones? If your wide table makes people pinch and scroll, it’s hurting usability and conversions. DataTable Responsive solves that by hiding low-priority columns and moving their data into expandable rows, so tables stay readable on small screens. This post walks you through the JavaScript setup, what files to load, the single initialization call, priority settings, breakpoints, and quick fixes, so you can ship fast, mobile-friendly tables that stay searchable and perform well on real devices.
How to Make DataTables Responsive (Step-by-Step)

DataTables Responsive is a JavaScript extension that automatically adapts multi-column tables to fit narrow viewports. When screen space runs out, the extension hides lower-priority columns and moves their data into expandable child rows or inline controls. This keeps tables readable on phones and tablets without forcing users to scroll sideways through dozens of columns.
The extension monitors viewport and container width in real time. It recalculates column visibility whenever the window resizes. Works by injecting small expand/collapse icons next to each row, so when a column gets hidden the user can tap the icon to reveal the full dataset. The extension also respects column-priority settings, letting you keep critical fields visible at all times while supplementary information collapses first.
DataTables Responsive runs entirely on the client side using jQuery and the DataTables core library. You’ll load three JavaScript files, a CSS stylesheet, and write a single initialization call to activate responsive behavior. Once enabled, the plugin handles breakpoints, DOM manipulation, and user interaction without any additional code.
Here’s the setup workflow:
- Include jQuery from a CDN or local copy.
- Load the DataTables core JavaScript and CSS files.
- Load the Responsive extension JavaScript and CSS.
- Mark up your table with standard HTML tags (thead for headers, tbody for rows).
- Assign a unique ID to the table element.
- Call
.DataTable({ responsive: true })on that ID using jQuery.
Here’s a working example:
<table id="customer-orders" class="display">
<thead>
<tr>
<th>Order ID</th>
<th>Customer</th>
<th>Date</th>
<th>Status</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr>
<td>1001</td>
<td>Maria Garcia</td>
<td>2024-03-15</td>
<td>Shipped</td>
<td>$247.50</td>
</tr>
</tbody>
</table>
<script>
$('#customer-orders').DataTable({
responsive: true
});
</script>
Optional configuration features let you fine-tune responsive behavior:
Custom breakpoints: Override default width thresholds by passing a breakpoints array to responsive: { breakpoints: [...] }.
Child-row display: Control how hidden column data appears using responsive: { details: { type: 'column' } }.
Column prioritization: Add responsivePriority inside columnDefs to keep specific columns visible longer. A priority value of 1 appears first, 2 appears second, and so on.
Alternative Methods for Creating Responsive Tables

Not every project needs DataTables’ sorting engine or pagination controls. If your table is small and static, a pure CSS solution can deliver responsive layout without any JavaScript overhead. CSS-only methods use media queries and display properties to reformat tables at narrow widths. Lighter on the browser and easier to maintain when you don’t need interactivity.
These approaches work well for simple content tables that show pricing, schedules, or product specs. They fail when you need to search, filter, or dynamically update hundreds of rows, since CSS alone can’t rebuild the DOM or manage state.
Three common CSS-only techniques:
Overflow-x wrapper: Wrap the table in a container with overflow-x: auto so users scroll the table horizontally on small screens. The table structure stays intact, but narrow viewports add a horizontal scroll bar. Add white-space: nowrap to table cells to prevent text from breaking mid-word.
Display-block stacking: Convert each table cell to display: block using a media query, then add the column label before each cell’s content using ::before { content: attr(data-title); }. Every row becomes a vertical card, with each field appearing on its own line.
Hide columns with media queries: Use media queries to hide less-important columns at narrow widths by setting display: none on specific td and th elements. You target columns by :nth-child() selectors or by adding classes to each column that needs to hide.
Here’s the overflow wrapper in action:
.table-wrapper {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
.table-wrapper table {
width: 100%;
white-space: nowrap;
}
Using DataTables Responsive with Bootstrap

DataTables ships with official Bootstrap integration files that apply Bootstrap’s table styles to your DataTable and ensure the Responsive extension works alongside Bootstrap’s grid system. When you combine both frameworks, you get Bootstrap’s visual polish and the Responsive extension’s smart column-hiding logic in one package.
The integration uses Bootstrap’s CSS classes for borders, striping, and hover effects, while the Responsive extension handles breakpoints and child rows independently. You can still use Bootstrap’s .table-responsive wrapper for horizontal scroll on very small screens, though it’s usually redundant once DataTables Responsive is active.
Follow these steps to set up the integration:
- Include Bootstrap CSS before the DataTables Bootstrap integration stylesheet.
- Include jQuery, then DataTables core, then the DataTables Bootstrap integration script.
- Include the Responsive extension JavaScript and CSS (use the Bootstrap-styled Responsive CSS variant if available).
- Add Bootstrap table classes to your table element, like
class="table table-striped table-bordered". - Initialize the table with
responsive: truein the DataTable configuration object.
Compatibility notes:
The Responsive extension’s child-row icons blend with Bootstrap button styles when you use responsive: { details: { type: 'inline' } }.
Bootstrap’s .table-sm class reduces padding and lets more columns fit before the extension hides them.
If you combine Bootstrap’s grid columns with DataTables, wrap the table in a .col-md-12 div to avoid layout conflicts.
Troubleshooting Responsive Issues

Responsive behavior can break when JavaScript files load in the wrong order, or when parent containers hide overflow and clip the table’s expand controls. Most failures happen during initial setup, when a required asset is missing or the table ID doesn’t match the jQuery selector.
Typical issues to check:
Missing Responsive extension files: Verify both the .js and .css files for the Responsive extension are loaded after DataTables core. Check the browser’s Network tab for 404 errors.
Wrong script load order: jQuery must load before DataTables, and DataTables core must load before the Responsive extension. Swap script tags if the order is wrong.
Parent container overflow: If the table sits inside a div with overflow: hidden, the child-row details can get clipped. Set overflow: visible on the container.
Incorrect table ID: The jQuery selector must match the table’s id attribute exactly. A typo in either location breaks initialization.
Fixed column widths: Hard-coded pixel widths on th or td elements prevent the Responsive extension from recalculating layout. Use percentage widths or remove inline width styles.
Dynamic content changes: If your app adds rows or columns after initialization, the extension doesn’t know the DOM changed. Call table.columns.adjust().responsive.recalc() after any update.
CSS conflicts: Other stylesheets can override DataTables’ responsive classes. Inspect the table in DevTools and look for unexpected display or visibility rules.
When you modify table content or container size after page load, DataTables needs a manual recalculation to update its internal column measurements. Use this command:
var table = $('#customer-orders').DataTable();
table.columns.adjust().responsive.recalc();
Layout-related fixes:
Remove white-space: nowrap from table cells if you want text to wrap instead of forcing horizontal scroll.
Set table-layout: auto to let the browser calculate column widths dynamically.
Avoid nesting DataTables inside other scrollable containers, since nested scroll areas confuse touch gestures on mobile.
Best Practices for Responsive DataTables

Optimizing responsive tables starts with reducing the number of columns you display by default. Every extra column increases the breakpoint width where the Responsive extension starts hiding data, so trim any fields the user doesn’t need immediately.
Follow these guidelines:
Limit initial column count: Show five to seven columns on page load. Move supplementary data into child rows or separate detail pages.
Assign responsive priorities: Use responsivePriority in columnDefs to keep critical columns visible. Priority 1 stays visible longest, then 2, then 3.
Enable server-side processing for large datasets: When your table has more than a few hundred rows, use serverSide: true and let the server handle filtering, sorting, and pagination to reduce DOM size.
Lazy-load images and complex cell content: If table cells contain thumbnails or embedded widgets, load them only when rows become visible using drawCallback hooks.
Avoid heavy initialization logic: Don’t run expensive calculations inside createdRow or rowCallback for every row. Preprocess data on the server when possible.
Use deferRender: true: This option delays rendering rows until they scroll into view, which speeds up initial load for tables with hundreds of rows.
Test on real devices: Emulators and DevTools device mode are helpful, but real phones reveal touch-interaction issues and actual rendering performance.
Minify and combine assets: Concatenate DataTables core, Responsive extension, and Bootstrap integration files into a single minified bundle to reduce HTTP requests.
Server-side processing becomes essential when client-side rendering slows down the browser. With serverSide: true, DataTables sends sorting, filtering, and pagination parameters to your backend via AJAX. The server returns only the current page of results as JSON, so the browser never handles the full dataset. This keeps the DOM light and interactions fast, even with tables that have tens of thousands of rows. Set it up by passing a serverSide: true flag and an ajax URL that points to your backend endpoint.
Comparison of Responsive Table Solutions

Each responsive table method trades features for simplicity. DataTables Responsive offers the most interactivity but requires jQuery and multiple script files. Pure CSS methods load instantly and need no dependencies, but you lose sorting and filtering. Bootstrap tables give you clean styling and grid integration, though you still need plugins for advanced controls.
| Method | Dependencies | Pros | Limitations |
|---|---|---|---|
| DataTables Responsive | jQuery, DataTables core, Responsive extension | Automatic column hiding, child rows, sorting, filtering, pagination, priority control | Requires JavaScript; larger file size; setup complexity |
| Pure CSS | None | No JavaScript; lightweight; fast load; easy to maintain | No interactivity; manual breakpoint management; no sorting or filtering |
| Bootstrap Tables | Bootstrap CSS, optional Bootstrap JS | Clean default styles; grid integration; responsive wrappers; familiar classes | Horizontal scroll only without plugins; no built-in column hiding or child rows |
Pick DataTables Responsive when you need full-featured data management and users will interact with the table by searching, sorting, or drilling into details. Choose pure CSS for small, read-only tables where speed and simplicity matter more than features. Use Bootstrap tables when you want consistent styling across your app and plan to add interactivity later with a plugin. For very large datasets that update frequently, combine DataTables’ server-side processing with the Responsive extension to get both performance and usability on mobile.
Final Words
In the action, you learned how to enable DataTables’ Responsive extension: add the CDN files, build a simple HTML table, and initialize with responsive: true. We also showed how to tune breakpoints and column priorities.
You explored CSS-only fallbacks, Bootstrap integration steps, and troubleshooting tips like calling columns.adjust().responsive.recalc() after content changes.
Follow the best practices — fewer columns, lazy loading, or server-side processing for big data.
If you apply these checks, your datatable responsive setup will work across devices. Nice progress — keep improving it.
FAQ
Q: How to responsive DataTable? / How to make a table responsive?
A: Making a DataTable or HTML table responsive means enabling DataTables’ Responsive extension (responsive: true) or using CSS wrappers (overflow-x: auto) and custom breakpoints to hide or stack columns.
Q: What are responsive tables?
A: Responsive tables are tables that adapt their layout to different screen sizes by hiding, stacking, or showing child rows so the data stays readable and usable on phones, tablets, and desktops.
Q: What is the stable version of DataTables?
A: The stable version of DataTables is the latest official release listed on the DataTables website or CDN; check the project’s download page or CDN links to find the current stable version number.

