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.
Paul
Posts: 101
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

Post by Paul »

1. Is it really the first column (index 0) you want to hide, or a different one? Yes.
2. If you try hiding any other column index, does it also fail to hide? Yes.
3. If you run the same code on a different browse/form, does it work? No.
4. Do you still see any errors in the browser’s developer console when the code runs? Yes.
Uncaught TypeError: columnWidths.forEach is not a function
This error only happens when a user other than globeadmin is logged in. It does not appear when globeadmin is logged in.
5. If you make a very simple test form with just a couple of columns, does the hiding work there No.
kev1n
nuBuilder Team
Posts: 4548
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 524 times
Contact:

Re: Hide a specific Browse column except for globeadmin user

Post by kev1n »

Which version are you using exactly? (Ctrl+Shift+V)

Otherwise, feel free to send me another DB dump via private message.
Paul
Posts: 101
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

Post by Paul »

Database: MySQL Community Server - GPL 8.0.43
PHP: 8.2.12
nuBuilder DB: V.4.9.2-2025.09.03.01
nuBuilder Files: V.4.9.2-2025.09.05.08
Paul
Posts: 101
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

Post by Paul »

Trying to send the .sql file but the private message area won't let me - "Invalid file extension."
kev1n
nuBuilder Team
Posts: 4548
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 524 times
Contact:

Re: Hide a specific Browse column except for globeadmin user

Post by kev1n »

Zip the file?
kev1n
nuBuilder Team
Posts: 4548
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 524 times
Contact:

Re: Hide a specific Browse column except for globeadmin user

Post by kev1n »

It could be related to the version on GitHub, since I’m unable to reproduce the issue with my local developer build (where the column is hidden as expected).

You can work around this by wrapping the code inside $(function() { ... }), which ensures it runs after the document has fully loaded

Code: Select all

$(function() {

  if (!nuGlobalAccess()) { 
    const columnIndex = 0; // specify the column you want hidden
    nuSetBrowseColumnSize(columnIndex, 0); // set column width to 0 (hidden)
  }
Paul
Posts: 101
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

Post by Paul »

I set up a seperate test db and web location called nubuildertest.
I used the latest from nuBuilder-master.zip
The test app has just two columns: case_name and case_location.


Database: MySQL Community Server - GPL 8.0.43
PHP: 8.2.12
nuBuilder DB: V.4.9.1-2025.09.22.00
nuBuilder Files: V.4.9.1-2025.09.22.00

In the Browse form:

Code: Select all

$(function() {

  if (!nuGlobalAccess()) { 
    const columnIndex = 0; // specify the column you want hidden
    nuSetBrowseColumnSize(columnIndex, 0); // set column width to 0 (hidden)
  }
Error when globeadmin logs in and goes to Browse form:

Code: Select all

Uncaught SyntaxError: Failed to execute 'appendChild' on 'Node': Unexpected end of input
    at m (jquery-3.7.1.min.js:2:880)
    at $e (jquery-3.7.1.min.js:2:46274)
    at ce.fn.init.append (jquery-3.7.1.min.js:2:47633)
    at nuAddJavaScript (nuform.js?ts=20251001060538:6322:12)
    at nuBuildForm (nuform.js?ts=20251001060538:143:3)
    at Object.successCallback (nuajax.js?ts=20251001060538:193:4)
    at c (jquery-3.7.1.min.js:2:25304)
    at Object.fireWith [as resolveWith] (jquery-3.7.1.min.js:2:26053)
    at l (jquery-3.7.1.min.js:2:77782)
    at XMLHttpRequest.<anonymous> (jquery-3.7.1.min.js:2:80265)
No error when another user logs in, but sees both columns.
Paul
Posts: 101
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

Post by Paul »

I then tried substituting the Browse form code with:

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
  }
This time, when globeadmin logs in, there is no error.
When the other user logs in, there is an error as before (and still sees both columns):

Code: Select all

nuform.js?ts=20251001065213:4951 Uncaught TypeError: columnWidths.forEach is not a function
    at nuSetBrowseColumns (nuform.js?ts=20251001065213:4951:15)
    at nuSetBrowseColumnSize (nucommon.js?ts=20251001065213:2504:16)
    at <anonymous>:15:5
    at m (jquery-3.7.1.min.js:2:880)
    at $e (jquery-3.7.1.min.js:2:46274)
    at ce.fn.init.append (jquery-3.7.1.min.js:2:47633)
    at nuAddJavaScript (nuform.js?ts=20251001065213:6322:12)
    at nuBuildForm (nuform.js?ts=20251001065213:143:3)
    at Object.successCallback (nuajax.js?ts=20251001065213:193:4)
    at c (jquery-3.7.1.min.js:2:25304)
kev1n
nuBuilder Team
Posts: 4548
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 524 times
Contact:

Re: Hide a specific Browse column except for globeadmin user

Post by kev1n »

Try the following:

- Open nuform.js for editing.
- Locate the line containing:
nuDragTitleEvents();

- Move it to the position shown in the screenshot.
- Save your changes.
- Log in to nuBuilder again.
You do not have the required permissions to view the files attached to this post.
Post Reply