Welcome to the nuBuilder Forums!

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

Exclude column from Search Topic is solved

Questions related to using nuBuilder Forte.
Post Reply
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Exclude column from Search

Unread post by toms »

Hi,

To exclude a column from being part of a Search, I can use this piece of code in the Browse Form's Javascript field in nuBuilderPro.

Code: Select all

   $("[id='nusearch_9'").prop('checked', false);
How can untick a checkbox in nuBuilderForte (by code)?
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Exclude column from Search

Unread post by admin »

toms,

I'm not sure what you mean.

Have you seen this? http://wiki.nubuilder.net/nubuilderfort ... le_Columns

Steven
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Exclude column from Search

Unread post by toms »

I'd like to have one column excluded (automatically) from the search by default. When a Browse Form is opened, a JavaScript is run to "untick" that column.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Exclude column from Search

Unread post by admin »

toms,

I will add this to the next update but I can't upload it at the moment.

You can try it out though.

Code: Select all


function nuSetNoSearchColumns(a){
	
	var s	= nuFORM.getCurrent().nosearch_columns;
	a		= s.concat(a);
	
	for(var i = 0 ; i < a.length ; i++){
		$('#nusort_' + a[i]).addClass('nuNoSearch');
	}

	nuFORM.setProperty('nosearch_columns', a);
	
}

Call it from the same place as all the other custom Javascript. On the Form who's Browse Form you want to change.

Code: Select all

nuSetNoSearchColumns([1,3,4);

BTW do you check the email address you registered on the forum?


Steven
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Exclude column from Search

Unread post by toms »

Thanks Steven, it works great!

I combined it with an own function nuGetColumnNumbers() so I can pass the column titles instead of their numbers.

Code: Select all

function nuGetColumnNumbers(columnTitles) {

    var a = Array();
    var bc = nuFORM.getCurrent();
    var col = bc.browse_columns;

    for (c = 0; c < col.length; c++) {
        var f = col[c].title;
        if (columnTitles.indexOf(f) != -1) {
            a.push(c);
        }
    }

    return a;

}

function nuSetNoSearchColumns(a){
   
   var s   = nuFORM.getCurrent().nosearch_columns;
   a      = s.concat(a);
   
   for(var i = 0 ; i < a.length ; i++){
      $('#nusort_' + a[i]).addClass('nuNoSearch');
   }

   nuFORM.setProperty('nosearch_columns', a);
   
}

nuSetNoSearchColumns(nuGetColumnNumbers(['emp_firstname', 'emp_lastname']));
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Exclude column from Search

Unread post by admin »

toms,

It was a good idea.

I would think a lot of people could use it.

I've added it to the wiki... http://wiki.nubuilder.net/nubuilderfort ... rchColumns

Steven
Post Reply