CodeIgniter comes with a useful library to handle HTML tables. It's simple to use and is able to handle most of the things you would need it for. Here, in this recipe, we're going to use it with DataTable to create an interactive HTML table that is sortable and searchable. It even has pagination! This recipe populates the table using a database query. If you're not looking for that and just want a simple table, try the preceding recipe—Using an HTML table with DataTable.
For this recipe, you will have to:
Ensure that you've downloaded DataTable from https://datatables.net/download/.
Unzip the downloaded
.zip
file, and move the files to a location on your web server or localhost, which will be accessible by CodeIgniter. For this recipe, I have put the folder in theapplication/views
folder; but you can make your own choice if you wish.As we're using CodeIgniter's HTML Table library to create a table for us with data from a table...