Hide Columns Based on User 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 “Hide Columns Based on User Role”

This solution involves hiding columns based on the role of the logged-in user. This may be useful if some roles do not need to view certain columns on your table component.

Step 1

Ensure your data table is set up to connect to the user roles.

Screenshot for “Hide Columns Based on User Role”

Step 2

Add the CSS class of "role-hide" to the column you wish to hide.

Screenshot for “Hide Columns Based on User Role”

Step 3

Get your component ID by hovering over the info icon.

Screenshot for “Hide Columns Based on User Role”

Step 4

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

Text
TB.render('component_10', function(data) {
    if (!"{loggedInUser.Role}".contains("Default Role")) {
        $('.role-hide').hide();
    }
});
Screenshot for “Hide Columns Based on User Role”

Original Community Post:

Hide Columns Based on User Role - Community Discussions / Tips and Tricks - Tadabase Community

Was this page helpful?

Something wrong or missing on this page? Tell us.