Page 1 of 1

Searchable Columns Button

Posted: Thu Jan 13, 2022 12:20 pm
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

Re: Searchable Columns Button

Posted: Thu Jan 13, 2022 1:07 pm
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!

Re: Searchable Columns Button

Posted: Thu Jan 13, 2022 5:49 pm
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

Re: Searchable Columns Button

Posted: Thu Jan 13, 2022 5:59 pm
by kev1n
It's better not to modify the core files. All changes get overwritten when updating.

Re: Searchable Columns Button

Posted: Thu Jan 13, 2022 6:52 pm
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

Re: Searchable Columns Button

Posted: Thu Jan 13, 2022 6:54 pm
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)

Re: Searchable Columns Button

Posted: Thu Jan 13, 2022 7:09 pm
by Andrea
Great! Thankyou :thumb:
The button shows up and works. I'm happy!

Best wishes

Andrea