Page 2 of 2

Re: Hide a specific Browse column except for globeadmin user

Posted: Tue Sep 30, 2025 7:34 pm
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.

Re: Hide a specific Browse column except for globeadmin user

Posted: Tue Sep 30, 2025 7:42 pm
by kev1n
Which version are you using exactly? (Ctrl+Shift+V)

Otherwise, feel free to send me another DB dump via private message.

Re: Hide a specific Browse column except for globeadmin user

Posted: Tue Sep 30, 2025 7:55 pm
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

Re: Hide a specific Browse column except for globeadmin user

Posted: Tue Sep 30, 2025 8:11 pm
by Paul
Trying to send the .sql file but the private message area won't let me - "Invalid file extension."

Re: Hide a specific Browse column except for globeadmin user

Posted: Tue Sep 30, 2025 8:16 pm
by kev1n
Zip the file?

Re: Hide a specific Browse column except for globeadmin user

Posted: Wed Oct 01, 2025 3:55 am
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)
  }

Re: Hide a specific Browse column except for globeadmin user

Posted: Wed Oct 01, 2025 6:48 am
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.

Re: Hide a specific Browse column except for globeadmin user

Posted: Wed Oct 01, 2025 6:57 am
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)

Re: Hide a specific Browse column except for globeadmin user

Posted: Wed Oct 01, 2025 8:06 am
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.