Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

Hide a specific Browse column except for globeadmin user

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
Paul
Posts: 96
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 22 times
Been thanked: 3 times

Hide a specific Browse column except for globeadmin user

Unread post by Paul »

How do I hide a specific column on the Browse form from all users except globeadmin?
kev1n
nuBuilder Team
Posts: 4540
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 523 times
Contact:

Re: Hide a specific Browse column except for globeadmin user

Unread post by kev1n »

nuSetBrowseColumnSize(column, size) sets the width of a browse column (by index) to the given size.
If you want to "hide" a column, you can call:

Code: Select all

nuSetBrowseColumnSize(columnIndex, 0); 
This will set the width to 0 and hide the first column.


Example: Hide the 2nd column of not globeadmin:

Code: Select all

if (!nuGlobalAccess()) {
    nuSetBrowseColumnSize(3,0);
}
(Add in form's Custom Code/Browse field)
Paul
Posts: 96
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 22 times
Been thanked: 3 times

Re: Hide a specific Browse column except for globeadmin user

Unread post by Paul »

Got an error using this:

Code: Select all

if (!nuGlobalAccess() !== 'globeadmin') {
    nuSetBrowseColumnSize(columnIndex, 0);
}


Uncaught ReferenceError: columnIndex is not defined
kev1n
nuBuilder Team
Posts: 4540
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 523 times
Contact:

Re: Hide a specific Browse column except for globeadmin user

Unread post by kev1n »

I updated the code above.

ChatGPT

I see what’s happening here. There are two issues in your code:

---

columnIndex is not defined
The error you’re getting is because columnIndex hasn’t been declared anywhere.
You need to pass an actual column index (0, 1, 2, …) or a variable that has been defined earlier.

Example:

Code: Select all

var columnIndex = 2; // whichever column you want to hide
-
✅ Corrected version

Code: Select all

if (!nuGlobalAccess()) {
    var columnIndex = 2; // pick the column you want hidden
    nuSetBrowseColumnSize(columnIndex, 0);
}
Paul
Posts: 96
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 22 times
Been thanked: 3 times

Re: Hide a specific Browse column except for globeadmin user

Unread post by Paul »

Error using this:

Code: Select all

//Hide column 1 if not globeadmin

if (nuGlobalAccess() !== 'globeadmin') {
    var columnIndex = 1; // pick the column you want hidden
    nuSetBrowseColumnSize(columnIndex, 0); //set column width to 0
}
Uncaught TypeError: columnWidths.forEach is not a function
kev1n
nuBuilder Team
Posts: 4540
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 523 times
Contact:

Re: Hide a specific Browse column except for globeadmin user

Unread post by kev1n »

See nuGlobalAccess() usage above/wiki. Then, where exactly did you add the code?

Code: Select all

if (!nuGlobalAccess()) {
    var columnIndex = 1; // pick the column you want hidden
    nuSetBrowseColumnSize(columnIndex, 0); //set column width to 0
}
Paul
Posts: 96
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 22 times
Been thanked: 3 times

Re: Hide a specific Browse column except for globeadmin user

Unread post by Paul »

I added your code above in my form's Custom Code/Browse field. It does not work. All users still see column 1.
Column 1 is user1d
hide-column1.PNG
hide-column1-1.PNG
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4540
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 523 times
Contact:

Re: Hide a specific Browse column except for globeadmin user

Unread post by kev1n »

The userId column appears to be the first column (index 0)
Paul
Posts: 96
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 22 times
Been thanked: 3 times

Re: Hide a specific Browse column except for globeadmin user

Unread post by Paul »

I changed the code to:

Code: Select all

//Hide column 0 if not globeadmin

 if (!nuGlobalAccess()) {
    var columnIndex = 0; // pick the column you want hidden
    nuSetBrowseColumnSize(columnIndex, 0); //set column width to 0
  }
but still get the same result as in my last post - everyone still sees column 0.
Post Reply