Skip to content

Commit

Permalink
Update DataTable to fix bug with search input
Browse files Browse the repository at this point in the history
  • Loading branch information
Ana06 committed Dec 3, 2018
1 parent dd23d1f commit 48d83d2
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions _posts/atoms/2018-08-30-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
description: A `%div` container with the CSS class `.table-responsive` makes the table responsive. The width of columns can be adjusted by using the
[Bootstrap's sizing classes](https://getbootstrap.com/docs/4.1/utilities/sizing/) on the `%th` tags
([Bootstrap's grid system](https://getbootstrap.com/docs/4.1/layout/grid/) doesn't work for tables in Chrome).
Additionally, we are using [DataTable](https://datatables.net/examples/styling/bootstrap4)'s [responsive](https://datatables.net/extensions/responsive/)
and style them with striped rows (`.table-striped`) and borders (`.table-bordered`). However, you can use tables with and without datatables.
Additionally, you can also use [DataTable](https://datatables.net/examples/styling/bootstrap4)'.
Style it with striped rows (`.table-striped`) and borders (`.table-bordered`).
Do not forget to initialize it with `initializeDataTable()` and to wrap it inside the class `.obs-dataTable`,
as this is solving a [bug related to the search field not being resposive](https://github.com/mkhairi/jquery-datatables/issues/14).
---

%h5 Table
Expand Down Expand Up @@ -34,27 +36,26 @@

%h5 Table with DataTable

%table.responsive.table.table-striped.table-bordered#my-datatable
%thead
%tr
%th Fruits
%th Origin
%th Vendor
%tbody
%tr
%td Oranges
%td Bananas
%td Kiwis
%tr
%td Spain
%td Brazil
%td Germany
%tr
%td Fruits Are Us
%td Fruits & Vegetables Inc.
%td SUSE Fruit Company Ltd.
.obs-dataTable
%table.table.table-striped.table-bordered#my-datatable
%thead
%tr
%th Fruits
%th Origin
%th Vendor
%tbody
%tr
%td Oranges
%td Bananas
%td Kiwis
%tr
%td Spain
%td Brazil
%td Germany
%tr
%td Fruits Are Us
%td Fruits & Vegetables Inc.
%td SUSE Fruit Company Ltd.

:javascript
$('#my-datatable').DataTable({
responsive: true
});
= content_for :ready_function do
initializeDataTable('#my-datatable');

0 comments on commit 48d83d2

Please sign in to comment.