Show columns based on the Users Role

Please note that this is now available as a plugin for easier installation. While you can use this document as a reference, the recommended method to add…

  • Not yet re-checked
  • Classic builder

Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.

Screenshot for “Show columns based on the Users Role”

This is a way to customize a table with different views based on the logged-in user's role. Follow the steps below for this great customization.

Step 1

Make sure you attach a specified role to each user.

Screenshot for “Show columns based on the Users Role”

Step 2

Add a CSS class for each assigned role, followed by the hide. Here I have management hide, packaging hide, shipping hide, and retail hide.

Step 3

Hover over the info icon on your page's data table to get the component ID.

Screenshot for “Show columns based on the Users Role”

Step 4

Add the following code to the JavaScript tab of your page.

Text
TB.render('component_ID', function(data) {
    if ('{loggedInUser.Role}' === 'Management') {
        $('.management').removeClass('hide');
    } else if ('{loggedInUser.Role}' === 'Packaging') {
        $('.packaging').removeClass('hide');
    } else if ('{loggedInUser.Role}' === 'Shipping') {
        $('.shipping').removeClass('hide');
    } else if ('{loggedInUser.Role}' === 'Retail') {
        $('.retail').removeClass('hide');
    }
});
Screenshot for “Show columns based on the Users Role”

Original Community Post:

https://community.tadabase.io/t/show-columns-based-on-the-users-role/1978

Was this page helpful?

Something wrong or missing on this page? Tell us.