Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Searchable Columns Button

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
Andrea
Posts: 29
Joined: Sun Jan 02, 2022 10:18 am
Been thanked: 1 time

Searchable Columns Button

Unread post by Andrea »

Hi all,

I would love to have the "Searchable Columns" command (options menue top left) as a button next to the other buttons like add, print a. s. o. (= within the div 'nuActionHolder').
So I made a change to function nuAddActionButtons(form) in nuform.js and added one more line for the button calling the same function:

$('#nuActionHolder').append("<input id='nuSearchField' type='text' class='nuSearch' onfocus='this.value = this.value;' onkeypress='nuSearchPressed(event)' onkeydown='nuArrowPressed(event)' value='" + s + "'>")
.append("<input id='nuFilter' style='visibility:hidden;width:0px' value='" + f + "'>")
.append("<button id='nuSearchButton' type='button' class='nuActionButton' onclick='nuSearchAction()'><i class='fa fa-search'></i>&nbsp;" + nuTranslate('Search') + "</button>")
.append("<button id='nuSearchListButton' type='button' class='nuActionButton' onclick='nuGetSearchList()'><i class='fa fa-columns'></i>&nbsp;" + nuTranslate('Searchable Columns') + "</button>");


The button is visible but onclick the "search columns popup window" gets visible for a short moment only and then disappears.
You can check this by adding a window.alert('test'); before the end of function nuGetSearchList().
There is something happening thereafter, which causes clearing the div 'nuSearchList'.

Would be great if you have an idea how to solve this.


The current german translation "Sortierbare Spalten" for the command "Searchable Columns" in nubuilder is a little confusing.
"Durchsuchbare Spalten" would be much clearer.

I changed it for my database:

Code: Select all

Update `zzzzsys_translate` set `trl_translation` = 'Durchsuchbare Spalten' where `trl_translation` = 'Sortierbare Spalten';

Many thanks in anticipation &
Best wishes

Andrea
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Searchable Columns Button

Unread post by kev1n »

Hi Andrea,

If I add a short delay, the popup window is displayed:

Code: Select all

nuAddActionButton('nuRunPHPHidden', nuTranslate('Searchable Columns'), 'setTimeout(function(){ nuGetSearchList(); }, 100);');   

The translation is fixed. Thanks!
Andrea
Posts: 29
Joined: Sun Jan 02, 2022 10:18 am
Been thanked: 1 time

Re: Searchable Columns Button

Unread post by Andrea »

Hi Kev1n,

great! It works :-)

.append("<button id='nuSearchListButton' type='button' class='nuActionButton' onclick='setTimeout(function(){ nuGetSearchList(); }, 100);'><i class='fa fa-columns'></i>&nbsp;" + nuTranslate('Searchable Columns') + "</button>");

Thanks a lot!

Best wishes

Andrea
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Searchable Columns Button

Unread post by kev1n »

It's better not to modify the core files. All changes get overwritten when updating.
Andrea
Posts: 29
Joined: Sun Jan 02, 2022 10:18 am
Been thanked: 1 time

Re: Searchable Columns Button

Unread post by Andrea »

You are right. Where is the right place for your code? How can I get it to show up at the right place ( div 'nuActionHolder')?

nuAddActionButton('nuRunPHPHidden', nuTranslate('Searchable Columns'), 'setTimeout(function(){ nuGetSearchList(); }, 100);');

Many thanks for your kind help!

Best wishes

Andrea
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Searchable Columns Button

Unread post by kev1n »

If you want this button to show up in every form, add it under Setup -> Header.
If it's just for one form, add the code in the form's Custom Code (Edit)
Andrea
Posts: 29
Joined: Sun Jan 02, 2022 10:18 am
Been thanked: 1 time

Re: Searchable Columns Button

Unread post by Andrea »

Great! Thankyou :thumb:
The button shows up and works. I'm happy!

Best wishes

Andrea
Post Reply