open vidu

Shipping A Full-Featured Video Calling App With Half The Effort (OpenVidu)

August 11, 2020
git workflow with multiple people

Git Workflow With Multiple People

September 1, 2020

Benefits Of Hiding Columns When Using Datatables.net

August 24, 2020 / Rayne Falkenberg

In reference to a previous blog post on the implementation of DataTables. This blog post will be about how I hide columns in tables so that other functionalities can be used from DataTables in a different way.

 

Example 1

Scenario: You have a set of data that needs to be ordered by the date the user confirmed their email address, but you do not want to display the date. First, make a table as below and add inline styles for the column (e.g., ’email_confirmation’) that you do not want to show by adding “display: none”.

Then, in your JS, add the code below.

  • The number points to the column that you are ordering the data by
  • And you can either use ‘desc’ for descending or ‘asc’ for ascending order.

 

Example 2

Scenario: You need to export a whole DB  table either to print it or save it as an Excel, but you don’t want to display all columns on your web page.

First, make a table with the inline styles as per the previous example

Then, in your JS, add the below:


And in your CSS, add the following:

Happy Coding!

Share

Rayne Falkenberg

Rayne is a developer manager with experience in web apps, mobile apps and project management.

Benefits Of Hiding Columns When Using Datatables.net
This website uses cookies to improve your experience. By using this website you agree to our Data Protection Policy.
Read more