Boost the standard performance of bootstrap 4 tables to be more beautiful and elegant. Using the default responsive table default bootstrap is still not user-friendly. If you need a plugin that can customize the default bootstrap table to be more responsive if opened using a smartphone or screen with a smaller resolution, the footable plugin is the best solution. I use a footable plugin to perfect the bootstrap standard table. Here’s the tutorial
FooTable is a jQuery Plugin that makes HTML tables on smaller devices look amazing without damaging the functionality and design. This plugin hides certain data columns at different resolutions and Rows becomes expandable to show hidden data.
What I like about the use of footable is the ease of use and settings. Also, the footable plugin can also be used without using bootstrap. Currently, the most stable version of the footable plugin is version 3.1.6 which can be directly downloaded on the GitHub page (not on the official site, as it has not been updated)
Table of Contents
A short tutorial on how to use the footable plugin
1. Download the footable plugin via the GitHub link
2. Add the footable.css and footable.js script like the following template
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"> <link rel="stylesheet" href="footable.bootstrap.min.css"> <title>Hello, world!</title> </head> <body> <h1>Hello, world!</h1> <!-- Optional JavaScript --> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script> <script src="footable.min.js"></script> </body> </html> |
3. Add the data-breakpoints attribute in the header table like the following example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | <table class="table"> <thead> <tr> <th data-breakpoints="xs">ID</th> <th>First Name</th> <th>Last Name</th> <th data-breakpoints="xs">Job Title</th> <th data-breakpoints="xs sm">Started On</th> <th data-breakpoints="xs sm md" data-title="DOB">Date of Birth</th> </tr> </thead> <tbody> <tr data-expanded="true"> <td>1</td> <td>Dennise</td> <td>Fuhrman</td> <td>High School History Teacher</td> <td>November 8th 2011</td> <td>July 25th 1960</td> </tr> <tr> <td>2</td> <td>Elodia</td> <td>Weisz</td> <td>Wallpaperer Helper</td> <td>October 15th 2010</td> <td>March 30th 1982</td> </tr> <tr> <td>3</td> <td>Raeann</td> <td>Haner</td> <td>Internal Medicine Nurse Practitioner</td> <td>November 28th 2013</td> <td>February 26th 1966</td> </tr> <tr> <td>4</td> <td>Junie</td> <td>Landa</td> <td>Offbearer</td> <td>October 31st 2010</td> <td>March 29th 1966</td> </tr> <tr> <td>5</td> <td>Solomon</td> <td>Bittinger</td> <td>Roller Skater</td> <td>December 29th 2011</td> <td>September 22nd 1964</td> </tr> <tr> <td>6</td> <td>Bar</td> <td>Lewis</td> <td>Clown</td> <td>November 12th 2012</td> <td>August 4th 1991</td> </tr> <tr> <td>7</td> <td>Usha</td> <td>Leak</td> <td>Ships Electronic Warfare Officer</td> <td>August 14th 2012</td> <td>November 20th 1979</td> </tr> <tr> <td>8</td> <td>Lorriane</td> <td>Cooke</td> <td>Technical Services Librarian</td> <td>September 21st 2010</td> <td>April 7th 1969</td> </tr> </tbody> </table> |
4. Run the following script after the table appears properly
1 2 3 | $(document).ready( function () { $('.table').footable(); }) |
Another article: Trick To Redirect New Window Or Tab With Post Method On Angular 5
If refresh the table body, run the above script to reinitialize the table.
1 | $('.table').footable(); |
in angulular cli I can not make it work, if I’m in the same module and surcharge works but if I go to another page and return does not load, I have to reload the page for some solution to work?
Sorry I have never tried it in angular 🙁