Page 1 of 2
Hide a specific Browse column except for globeadmin user
Posted: Mon Sep 29, 2025 8:56 pm
by Paul
How do I hide a specific column on the Browse form from all users except globeadmin?
Re: Hide a specific Browse column except for globeadmin user
Posted: Tue Sep 30, 2025 4:59 am
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)
Re: Hide a specific Browse column except for globeadmin user
Posted: Tue Sep 30, 2025 6:24 am
by Paul
Got an error using this:
Code: Select all
if (!nuGlobalAccess() !== 'globeadmin') {
nuSetBrowseColumnSize(columnIndex, 0);
}
Uncaught ReferenceError: columnIndex is not defined
Re: Hide a specific Browse column except for globeadmin user
Posted: Tue Sep 30, 2025 6:31 am
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);
}
Re: Hide a specific Browse column except for globeadmin user
Posted: Tue Sep 30, 2025 6:43 am
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
Re: Hide a specific Browse column except for globeadmin user
Posted: Tue Sep 30, 2025 6:49 am
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
}
Re: Hide a specific Browse column except for globeadmin user
Posted: Tue Sep 30, 2025 7:02 am
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
Re: Hide a specific Browse column except for globeadmin user
Posted: Tue Sep 30, 2025 7:24 am
by kev1n
The userId column appears to be the first column (index 0)
Re: Hide a specific Browse column except for globeadmin user
Posted: Tue Sep 30, 2025 5:01 pm
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.
Re: Hide a specific Browse column except for globeadmin user
Posted: Tue Sep 30, 2025 6:55 pm
by kev1n
1. Is it really the first column (index 0) you want to hide, or a different one?
2. If you try hiding any other column index, does it also fail to hide?
3. If you run the same code on a different browse/form, does it work?
4. Do you still see any errors in the browser’s developer console when the code runs?
5. If you make a very simple test form with just a couple of columns, does the hiding work there?